Do universal windows assemblies work with a .net console app? - c#

I am working on a Universal Windows assembly and cannot add a reference to it from a C# console application project in the same solution. The console app would be a simple test bed application for interactive use of the universal dll.
Do universal windows assemblies not work with straightup Console apps? When I try to add a reference to the universal project VS.NET shows a very uninformative "Cannot add reference to project" message.

They don't. But if you want to share assemblies between different platforms you should move the logic to a new assembly and setup this one as PCL (portable class library) setting the platforms you want to support.
That's because Universal windows Apps doesn't share the same "binary" formats with classic .Net Framework Applications. They don't even share the same CLR.

Related

Build Pjsip windows sdk/.net 6 target dll

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

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.

Add Windows Phone platform support to existing C# project

I have an opes-source project which I want to use on Windows Phone. Currently it targets one of the following: Any CPU, x86 or x64. Apparently, when I build and try to use the output as a reference in a Windows Phone project, I'm getting an error: A reference to a higher version or incompatible assembly cannot be added to the project.
I'm trying to build that open-source project so that it would target Windows Phone platform. To achieve that, I'm trying to find a way to add Windows Phone platform somewhere in VS project's settings, but with no luck. Is it possible at all? If yes, how?
Thanks.

Can I use a Windows -> Class Library inside a WP7 application?

I'm creating a library application that will act as a wrapper for an exposed API. This library ideally should work on any desktop application, but truth be told I'm intending to use this on the WP7 once I'm done creating the library.
Would this work?
From silverlight.net:
Silverlight is the application development platform for Windows Phone 7. High performance gaming is also supported through the XNA Framework.
You can't reference a .NET assembly which was compiled against the full .NET Framework in a Silverlight application.
Develop your library for Silverlight and all should be fine.

Categories

Resources