Welcome to Microsoft Q&A!
Are you using VS2022? What is your project’s target framework? Does it occur in new created C# console project?
Please close all running VS instances and open the Visual Studio Installer > Modify > make sure you have the .NET desktop development workload installed.
Then, edit your System Environment variables and add this one to Path: C:\Program Files\dotnet, not C:\Porgram Files (x86)\dotnet.
After deleting, please restart your computer and launch the VS to check that it works properly.
Sincerely,
Anna
If the answer is helpful, 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.