How to add .NET dll link for UWP project?

I have several .NET DLL projects for .NETv4.x. I changed the version to 4.6.1 and recovered without problems. When I try to add referene to them from my UWP project, I get an error message:

The goal of the project is '.NETCore', while target links to the '.NET Framework' file. This is not a supported scenario.

I also cannot link to .NET projects from "Add Link ..." → "Projects":

Unable to add project link

But in the project settings, I do not see anything to change its purpose to ".NETCore". Can I reference a .NET4.x project from a UWP project or convert it to a UWP project type?

+6
source share
1 answer

A UWP project can reference a universal Windows class library, a portable library, or a Windows Runtime component. Your classic .NET projects are neither one nor the other.

If you plan to continue developing and using these libraries both in classic .NET projects and in UWP, I suggest you try the Portable Library, where you can choose target platforms, but be careful that this approach may be somewhat limited, since it takes the lowest common denominator for available namespaces and classes.

Another approach would be to create two different projects focused on classic .NET and UWP, and share the code between them, adding files as links or using a common project. Then solve all the problems with conditional compilation, create them and use the corresponding .dll output for both cases.

+10
source

All Articles