Alright, i got the fix from a friend. Turns out i had the program filex x86 dotnet added to PATH in enviroment variables, and it was breaking it.
dotnet SDK isnt found/recognized.
Ive been having a problem with .NET SDK. Whenever im trying to do anything with the SDK, its like its not there, even though i have it installed, and its added to the PATH system variable. Im gonna attach pics in the replies. When im not in the dotnet folder and i try dotnet --version i get a error
Could not execute because the application was not found or a compatible .NET SDK is not installed.
Possible reasons for this include:
* You intended to execute a .NET program:
The application '--version' does not exist.
* You intended to execute a .NET SDK command:
It was not possible to find any installed .NET SDKs.
Install a .NET SDK from:
https://aka.ms/dotnet-download
However when im in the C:\Program Files\dotnet and i run the same command i get the version - 8.0.401.
Other commands like dotnet --info work anywhere, but the sdk is only regocnized in the dotnet folder.
2 answers
Sort by: Most helpful
-
-
Jiale Xue - MSFT 49,051 Reputation points Microsoft External Staff
2024-09-04T10:00:42.0133333+00:00 Hi @Michał Delert ,Welcome to Microsoft Q&A,
Since Q&A cannot mark its own answer as closed, I have summarized your question and answer.
Your problem is due to a conflict in the Program Files (x86)\dotnet path in the environment variables. Program Files (x86) is a directory for 32-bit programs, and you are using the 64-bit version of the .NET SDK. When the system looks for the dotnet executable in the PATH environment variable, it first finds Program Files (x86)\dotnet, which can cause the system to not correctly recognize and use the 64-bit SDK, which in turn causes errors when you run commands such as dotnet --version.
By removing Program Files (x86)\dotnet from the environment variables, the system can correctly recognize the 64-bit SDK under Program Files\dotnet, thus solving this problem.
Best Regards,
Jiale
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.