Note: I use VS 2019 Professional Version 16.0.2
Problem: I have a source code base working perfectly fine in VS 2017. But to support .NET core 3.1, I have decided to upgrade my VS 2017 to VS 2019. When I open-source code in VS 2019. It's not showing .NET Standard 2.1 and .NET Core 3.1 as part of Target Framework. When I look for project properties.
When I modify .csproj file with <TargetFramework>netcoreapp3.1</TargetFramework>
and then build I get:
The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1.
For another project, When I modify the .csproj file with <TargetFramework>netstandard2.1</TargetFramework>
and then build I get:
The current .NET SDK does not support targeting .NET Standard 2.1. Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1.
What I have tried:
- Now I decided to create a brand new project in VS 2019. Then the
the surprising thing is it just shows me
.NET Standard 2.1
and.NET Core 3.1
as part of Target Framework. - Also looking at the previous StackOverflow answers. I have created the global.json file at the top of my solution. global.json look like
{ "sdk": { "version": "3.1.402" } }
but I as part of my solution. I have 2 projects. The first project is netstandard
and the second project is netcore
[my test project is netcore]. The test project allows me to select 3.1 from the project property target framework section but my first project is not able to show me netstandard2.1
as part of the project property target framework. Did my global.json is wrong?
Expectation: My source code which is building perfectly on VS 2017 should have been building on VS 2019.