The issue was with GLobal.JSON pointing to .net 3.1.
Removed it and the issue resolved.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I recently installed Visual Studio 2022 on a machine which had VS 2019.
When I create a project targeting .net6.0 I get the following error.
MSB3971 - The reference assemblies for ".NETFramework,Version=v6.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. Test C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 1229
I have verified I have all the necessary SDKs including for version 6.0. Both the SDK as well as the VS 2022 are 64 bit installations. The Path environment variable has C:\Program Files\dotnet which has the necessary SDK.
The .csproj target framework is also rightly set. I have repaired the installation, uninstalled and reinstalled it and have also removed VS 2019, but to no avail.
Kindly help.
Attached is a detailed log from the build output for further troubleshooting.BuildLog_Detailed.txt
The issue was with GLobal.JSON pointing to .net 3.1.
Removed it and the issue resolved.
Hello @Shareef, Ruman,
Welcome to Microsoft Q&A forum.
Is there any unnecessary Path environment variable set about dotnet/SDKs on your side, except C:\Program Files\dotnet
? If so, please try to delete it/them and restart VS.
Please open VS Installer > Modify > Individual components > .NET > and make sure that .NET 6.0 Runtime and .NET SDK have been checked > close VS and VS Installer > run devenv /ResetSettings
in Developer Command Prompt for Visual Studio 2022 Enterprise
> create a new project and check if the issue disappears.
I may also suggest you try to install the latest version of .NET 6.0 separately. Disable any installed third-party extensions/antivirus temporarily, reboot your machine and check again.
Sincerely,
Tianyu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.