Firstly, there is a known issue where the RTM release of the .NET 7 SDK which ships with VS 2022 can stomp the .NET 6 SDK. You can refer to some help here but ultimately repairing the .NET 6 SDK seems to resolve it IIRC.
The second thing is that VS 2022 is x64 whereas previous versions of VS where x86. The SDKs are installed as both x86 and x64. The version of MSBuild running in VS 2022 is x64 so you need to ensure you have the x64 version of the SDK installed as well.
Your post seems to have conflicting reports of the .NET 6 availability.
While creating new project I got the option to select .net 6.0
I also noticed that .net 6 is not present in target framework list which is shown within project properties
So I'm confused here. When you create a new project you should see the options of .NET 6 and .NET 7. However be aware not every project type supports both frameworks. If you open an existing .NET Core/5/6/7 project then you should see the option for .NET 6. However you will not see this option for .NET Framework projects as they only go up to .NET 4.8. To convert a .NET Framework app to .NET 6 you'll need to convert the project to the SDK project format first and then you can set the target framework. The UI (outside a helper extension) doesn't support this.
The list of target frameworks is for .NET Framework, not .NET Core which is where .NET 6/7 resides. If this is the project you literally just created then something is seriously wrong as you're seeing the wrong list of platforms. Can you show us the content of your .csproj file?
You are right, this is the project that I just created. Here is the csproj file content.
Just to confirm but when you installed VS you opted into installing the .NET Core workloads right? Run the installer and go to
Individual Components, then verify .NET 6.0 Runtime is checked.
Hey Yes I see that it is checked.
Hmm. You already said you didn't have a global.json file anywhere which is the next thing to look at. Let's check the path variable then. Look at your PATH environment variable. Make sure that
C:\program Files\dotnetis higher in the path list than any other version.
This helped, there was another dotnet path above C:\program Files\dotnet . I moved C:\program Files\dotnet up and that helped solve the problem. Thanks!
Sign in to comment