简体   繁体   中英

When adding .NET Core class library reference to UWP app, it says “Unable to add a reference to project…”

To test this I created a new UWP app project.

The Target Version and Minimum Version of the project are both "Creators Update Build 15063".

I simply added a new .NET Core class library project to the solution and attempted to reference the .NET Core class library from the UWP project and the error appeared.

Also note that I even updated the Microsoft.NETCore.UniversalWindowsPlatform nuget package version in the UWP project to version to v5.3.3. The same error appears.

What gives? O_o

.NET Core is a completely different runtime than UWP.

When you create a .NET Core class library, it is one specifically and solely for .NET Core.

Instead, create a .NET Standard class library. You can reference a .NET Standard class library from many different runtimes, including both UWP and .NET Core.

Be sure to know which version of the .NET Standard you want to target in your class library. In general, target the lowest version you can successfully compile your library with.

You can read more about .NET Standard here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM