using .NET Standard 2.1 with UWP

谁说我不能喝 提交于 2019-12-07 04:37:42

问题


I made the big mistake of taking some NuGet library updates today. It forced me to either roll back a week's worth of work, or upgrade to ASP .NET Core 3.0. I hate to use stuff that's not production, but I didn't want to untangle the libraries either, so I upgraded. Then it force me to retarget .NET Standard 2.1 libraries. Which I did. My problem now is with the client UWP code. When I try to compile, I get:

error : Project '..\ClassLibrary1\ClassLibrary1.csproj' targets 'netstandard2.1'. It cannot be referenced by a project that targets 'UAP,Version=v10.0.10586'.

This happens even with a virgin UWP and .NET Standard 2.1 library. Any clues how to make Visual Studio 2019 client code work with the latest upgrade?


回答1:


All Windows 10 SDKs currently don't support .NET Standard 2.1.

Windows 10 19H2 is using the same SDK number as 19H1, so it is unlikely that it will support .NET Standard 2.1. (But I certainly hope it does.)

Microsoft hasn't made an official announcement, but Windows 10 20H1 is getting a meaningful SDK update, so it is likely that it will support it. And once that's the case, UWP apps will require 20H1 to run (so that will become the minimum supported version).

One of the big issue with this situation is that Entity Framework Core 3.0 requires .NET Standard 2.1, so it can't be used in UWP apps for now.

By the way, as an experiment, I was able to fork Entity Framework Core 3.0 (for SQLite) and make it compile on .NET Standard 2.0. I basically had to manually copy a few new APIs from .NET Core 3.0 (like IAsyncXXX). And it worked, so it is an option for people who really need it. Note that, I did not try it with the SQL Server provider.




回答2:


UWP does not support .Net standard 2.1 yet. It only support till .Net standard 2.0 and that too from windows 1709 onwards.

If you look at the link for 2.1 it states

Platform Support

  • An upcoming version Universal Windows Platform

so it may be 19H2



来源:https://stackoverflow.com/questions/58070082/using-net-standard-2-1-with-uwp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!