I am unable to build projects targeting .Net 5 in the latest version of VS2019 (16.9.0). It's a simple solution with a class library project and a test project. The class library is multi-targeting as follows: <TargetFrameworks>netstandard2.0;net48;net5.0</TargetFrameworks>
Most answers surrounding this are pre-release, but I've been building apps targeting .net 5 for a little while now and this is a new error.
It is installed:
PS C:\Users\me> dotnet --list-sdks
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.400 [C:\Program Files\dotnet\sdk]
2.1.401 [C:\Program Files\dotnet\sdk]
2.1.402 [C:\Program Files\dotnet\sdk]
2.1.521 [C:\Program Files\dotnet\sdk]
2.1.617 [C:\Program Files\dotnet\sdk]
2.1.700 [C:\Program Files\dotnet\sdk]
2.1.701 [C:\Program Files\dotnet\sdk]
2.1.813 [C:\Program Files\dotnet\sdk]
2.2.101 [C:\Program Files\dotnet\sdk]
2.2.207 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
3.1.406 [C:\Program Files\dotnet\sdk]
5.0.103 [C:\Program Files\dotnet\sdk]
5.0.200 [C:\Program Files\dotnet\sdk]
and
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional> csc -langversion:?
Supported language versions:
default
1
2
3
4
5
6
7.0
7.1
7.2
7.3
8.0
9.0 (default)
latestmajor
preview
latest
The error I get on build is:
error MSB3971: The reference assemblies for ".NETFramework,Version=v5.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK.
I'm suspecting something to do with the solution file but nothing stands out to me, as I've never seen this before. It appears to be loading .NETFramework instead of .NETCore and looks confused. Is this a new bug?