.net core – Cannot run dotnet.exe from CMD or compile in Visual Studio 2022


I ran a command prompt as an admin, and executed the following command:

C:\Windows\System32\dotnet.exe

A dialog popped up saying:

This app can’t run on your PC
To find a version for your PC, check with the software published.

Then, in the prompt, it outputted:

Access is denied

Meanwhile, I was unable to compile any solution in Visual Studio 2022, though I can’t recall the specific error message.

I decided to wipe everything (the .NET SDK, Visual Studio 2022, and many temporary folders) and reinstalled Visual Studio 2022.

Unfortunately, the situation worsened. Now, I can’t even load .NET projects, getting an error:

The SDK ‘Microsoft.NET.Sdk’ specified could not be found.

Before posting this question, I tried various solutions found online, such as creating a new folder in Program Files (x86) and adjusting the order of paths in the system variable Path.

Thank you in advance for your help.

Leave a Reply

Your email address will not be published. Required fields are marked *