I have several .NET dll projects for .NETv4.x. I changed version to 4.6.1 and rebuilded without problems. When I try to add referene to them from my UWP project I get error:
The project targets '.NETCore' while the file reference targets '.NETFramework'. This is not a supported scenario.
I can't also reference .NET projects from 'Add reference...'->'Projects':
Unable to add a reference to project
But in project settings I can't see anything to change it's target to '.NETCore'. Is it possible to reference .NET4.x project from UWP project or convert it to UWP project type?
NET Standard is supported in which UWP versions. If you are developing a Desktop app, see instead . NET Framework versions and dependencies for detailed information on .
You can also right-click the project node and select Add > Project Reference. If you see a References node in Solution Explorer, you can use the right-click context menu to choose Add Reference. Or, right-click the project node and select Add > Reference.
UWP project can reference Universal Windows Class Library, Portable Library or Windows Runtime Component. Your classic .NET projects are none of those.
If you're planning to continue to develop and use those libraries in both classic .NET projects and UWP, I suggest you try Portable Library in which you can choose target platforms, but beware that this approach can be somewhat limiting because it takes lowest common denominator for available namespaces and classes.
Another approach would be to create two different projects targeting classic .NET and UWP, and share the code between them either adding files as links or using Shared Project. Then resolve all problems with conditional compilation, build them and use appropriate output .dll's for both cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With