I cant get Visual studio to use .NET 5.
The following are my current configuration: Visual Studio Professional 2019 version: 16.7.6
.NET sdk: dotnet-sdk-5.0.100-preview.7.20366.6-win-x64 (see image for more info)
Visual Studio settings:
I have selected "Use previews of the .NET Core SDK" in VS (See image)
Possible source of my problem: I accidentally installed preview 8 of .NET 5, this version don't support my version of Visual Studio. I removed this version and installed the correct one (preview 7 should have support for VS 16.7, see: https://dotnet.microsoft.com/download/dotnet/5.0)
These are the steps I take to reproduce my problem:
in visual studio I do the following to create a .net 5 project (blazor project):
- start vs 2019
- select "Create a new project"
- select "Blazor App"
- give the project a name/Location/solution name and click "Create"
- select .Net 5.0 (.net core 3.1 is also available) and Blazor Server App and click "Create" (see image)
6.the project is now created but a error message is instantly displayed "the reference assemblies for .NETFramework, Version=v5.0 were not found. ..." (see image)
7.right click on the project -> Properties
8. "Target framework" are now blank, If i open the dropdown only .Net framework versions are available (see image)
Other information that might have value: If i creat a new project and select .Net core 3.1 instead of .net 5 everything is working fine. Doing this alows me to see items other than .Net framework in the "Target frameworks" dropdown, .NET 5 are however still missing. (see image)
If i go to "Add or remove programs" .Net 5 of the correct version are listed. (it is also the only listed version of .NET 5)
If i look at the system path it is correctly set to: "C:\Program Files\dotnet"
Why is this happening? how can i get .net 5 to correctly show in this list?
#Update 1: After installing Visual studio 16.8.0 Preview 5.0 the problem still persists .NET 5 can't be used. If i look at Dependencies it is clear that something is wrong, non of the entries under Dependencies -> Assemblies are found/has a value (see image)
#Update 2: finally found a solution 4 this problem using global.json, see my own answer for more details