Build Pjsip windows sdk/.net 6 target dll - c#

I am trying to create a pjsip dll and add it to an Uwp app. I have built a dll following this (working fine for WPF). Which gives an error while adding dll to the Uwp project saying unsupported-frameworks don't match as uwp targets Windows SDK. Creating a .net standard 2.0 class library as a bridge also didn't work.
At first, I found this solution. But this also produces more errors.
Now, I want to create a dll for Pjsip and use it in my UWP app. I am badly in need of a solution for creating windows SDK using pjsip or a suggestion regarding workarounds to use the current win32 .net framework targetted dll in the uwp project.

I have build pjsua2 dll and working fine using this link

Related

Can I refer from a UWP project to a .NET Standard project?

I created an UWP app, and a .NET 6.0 project, and added reference of UWP project to the .NET 6 project.
Output of executing proj.bat file that runs this solution executes the following error:.
Error NU1201: Project MyUWPProject is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Project MyUWPProject supports
: uap10.0.18362 (UAP,Version=v10.0.18362)
How can fix this? Is what I'm trying to do even possible?
The error message shows that the environment of your .NET 6.0 project is .net6.0 and the environment of the UWP project doesn't support .net6.0. So the UWP project is not compatible with the .NET project.
If you want to use Windows Runtime APIs, you could just make some confirugation in for your .NET 6.0 porject so that you could directly call Windows Runtime APIs in your app. You will need to Edit Your Project File and Modify TargetFramework Element to net6.0-windows10.0.19041.0.
You could check this document - Call Windows Runtime APIs in desktop apps for detailed steps.

Using WinUI 3 in a Visual Studio desktop MFC class library project

To extend a third party MFC application I must create a desktop static MFC class library (i.e. dll). Using C++ I successfully completed the logic/backend portion of the project. With the aid of C++/winrt nuget package, I had a wealth of APIs that helped. Note my preferred language is C# with Visual Studio should that be relevant.
For the user interface I would like to completely use WINUI 3 instead of MFC APIs. Currently a desktop win32 WINUI solution must include a packaging project (i.e. MSIX) to get the required APP ID. This seems like a fundamental problem since I must produce a MFC dll and not a full blown application/exe install. If necessary I can wait (Not preferred) for Windows APP SDK 1.0, but I need to confirm this solves my problem and a release is coming.
Alternatively I may need to use WinRT XAML hosting API (XAML islands). This has limitation, but is this still the best/only viable option for WINUI in a C++ MFC desktop unpackaged app?
Basically how can I best utilize WINUI 3 in my MFC class library project?

Is it possible to add a System.windows.form reference to a Xamarin project?

I am developing a Xamarin.Forms app in Visual Studio and I need to use an external SDK that is dedicated for Windows Form apps. I have been trying to add a reference to System.Windoes.Form but it doesn't appear in the assemblies.
I know it wouldn't make sense using windows forms in a Xamarin project, but I am creating the user interface with Xamarin graphics, I just need to add the reference to Windows.Forms to get rid of the following error:
Can not resolve reference: System.Windows.Forms, referenced by MY DLL. Please add a NuGet package or assembly reference for System.Windows.Forms, or remove the reference to MYDLL.
Is there a way to do so?
Thanks
.NET can be categorized into three and those are, .NET Core, .NET Framework and Xamarin.
The .NET Framework supports Windows and Web applications.
.NET Core is the new open-source and cross-platform framework to build applications for all operating system including Windows, Mac, and Linux.
When you want to build mobile (iOS, Android, and Windows Mobile) apps using C#, Xamarin is your only choice.
You cannot use System.Windows.Forms inside a Xamarin Project and it is incompatible.

How to use C# dll in UWP

I have a C# dll compiled in .net framework 2.0 and the library is not been updated by the vendor till now. In one of my desktop application C# i was using that and when i migrated the application to WPF, the same libraries where referred and working fine. Now, the application required new diversion, as it should be upgraded to UWP and the same dll i want to make use in that also. What is the best and easiest methods available in UWP to import.Net Framework 2.0 dll ?
Regards,
Lal
You can create a .NET Standard 2.0 library project that can reference the legacy library and you can then reference this .NET Standard 2.0 project from you UWP app.
In the .NET Standard library, you can write custom types that access the legacy library and provide a "middleware layer" between the UWP app and the legacy library.
What is the best and easiest methods available in UWP to import.Net Framework 2.0 dll ?
You can not direct consume any full .NET Class Library from UWP app, there is some security restrictions. UWP project can reference libraries such as Universal Windows Class Library,.NET Standard library, Windows Runtime Component and so on.
For solving this, since your app is for desktop devices and you already have a WPF app, I recommend you to convert the WPF app to UWP app by using Desktop Bridge. Or you could try to convert the old dll into one of above the libraries that can be referenced by UWP app. If you do only want to consume the .Net framework dll, you may try to create COM Proxy Stubs and work with them as communication layer, here is the official sample.
One solution for this is to make a windows service and use that dll in service. You can reference that service from UWP application in order to make all the API calls.

.NET Standard 1.4 Class Library in UWP app

I'm exploring the idea of using this product in a UWP app, and one approach I'm starting to look at is to port the available C# .NET wrapper the manufacturer made available on their website to a Class Library using .NET Standard 1.4.
https://www.usdigital.com/products/interfaces/pc/usb/USB4
I believe I've got it close where I can reference the library in my UWP app and it runs, but I keep running into issues like the one below. I've tried referencing NuGet packages for System.Threading.ThreadPool (v4.3.0) and NETStandard.Library (v1.6.1), but it doesn't work. I have verified that the ported class library still works for an existing .NET desktop app we've used it on.
Could not load file or assembly 'System.Threading.ThreadPool,
Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
The system cannot find the file specified.
Edit1:
I've removed portions of code that reference System.Threading and it seems that was the least of my problems. UWP app now runs, however it's unable to read from the device. Verified it still works on the old .NET desktop app with the modification.
The class library has a bunch of [DllImport("USB4.dll")]. Is that not supported in .NET Standard 1.4?

Categories

Resources