17

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 forces 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 on how to make Visual Studio 2019 client code work with the latest upgrade?

Hamada
  • 1,836
  • 3
  • 13
  • 27
Quark Soup
  • 4,272
  • 3
  • 42
  • 74
  • My Current config to test a "UWP project as my UI layer" that references a "class library as my Business layer": [![img](https://i.stack.imgur.com/9FCHP.png)](https://i.stack.imgur.com/9FCHP.png) – Adil El Hadri Jun 18 '20 at 09:32
  • Is this been resolved? I change `TargetFramework` to `netstandard2.1` in my Core .csproj and UWP stops running. Just installed VS22 and it is not working – vmp1r3 Nov 14 '21 at 06:20

2 Answers2

21

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 (Update: This issue is resolved with Entity Framework Core 3.1 supporting .NET Standard 2.0).

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.

Update: The UWP team is planning to enable UWP apps to use .NET 5 and that's when UWP will support .NET Standard 2.1 (and more). This could happen in 20H2 or 21H1.

user12115040
  • 221
  • 1
  • 4
11

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

UPDATE

Microsoft is going to release a new framework called WinUI 3, this is going to support UWP as well as Win32 based application model. WinUI 3 would support .Net 5 for both the platforms. WinUI 3 preview is going to be available in mid May 2020, with final release in late 2020. WinUI 3 would be supported on windows 10 1803+.

Community
  • 1
  • 1
resp78
  • 1,414
  • 16
  • 37
  • 2
    Have you got a reference for that? Entity Framework Core 3.0 only works with .NET Standard 2.1, so that means you can't use the latest EF Core in a UWP application, which seems like kind of a big deal. – Quark Soup Sep 24 '19 at 10:05
  • I can understand the frustration. I am hoping to move towards using WinUI Desktop when it arrives (hopefully next year). You may like to keep an eye on [Question: Prepare for WinUI desktop](https://github.com/microsoft/microsoft-ui-xaml/issues/1365) – resp78 Sep 24 '19 at 10:35
  • 1
    The good news is they already fixed Android and iOS ... hopefully UWP is next. https://learn.microsoft.com/en-us/dotnet/standard/net-standard – Victor Thomas Wilcox Jr. Oct 21 '19 at 20:43
  • @VictorThomasWilcoxJr. It's been TBD since day dot! – Amir Hajiha Oct 22 '20 at 11:54
  • Aye!... had given up checking. Between .net 5.0 coming out and MAUI supplanting Xamarin, I wonder if that point will never come. Fortunately, once they made EF work with .Net Standard 2.0, it hasn't been a problem for me. – Victor Thomas Wilcox Jr. Oct 23 '20 at 18:12
  • What a mess. What a shambles – Richard Hammond Feb 03 '23 at 05:00