The SDK 'Microsoft.NET.Sdk' specified could not be found. in Visual Studio Community 2022 version 17.5

Raihanudin Rafif 65 Reputation points
2023-02-28T06:50:12.9966667+00:00

Since Visual Studio 2022 updated from version 17.4 to 17.5, I couldn't load my project. and get the error "The SDK 'Microsoft.NET.Sdk' specified could not be found." But if the project was opened in version 17.4, the project was loaded successfully.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,578 questions
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 27,106 Reputation points Microsoft Vendor
    2023-02-28T13:54:14.22+00:00

    Hello @Raihanudin Rafif ,

    Welcome to Microsoft Q&A forum.

    Please first confirm that .NET SDK has been checked in VS Installer > Modify > Individual components > .NET > .NET SDK. If it isn’t checked, please check it and click Modify.

    Please then create a new .NET based project and check if the same error appears, if the same error appears, please try following to narrow down this issue:

    1. Reboot your machine and restart VS.
    2. Repair Visual Studio from VS Installer > More > Repair.
    3. Reset VS settings(run Developer Command Prompt for Visual Studio 2022 > run devenv /ResetSettings).

    If the same error doesn’t appear, then please try following:

    1. Right-click your project > Unload Project > confirm that the <Project Sdk="Microsoft.NET.Sdk"> line exists > right-click your project again > Reload Project. Open VS Installer > Modify > Individual components > .NET > make sure that .NET SDK has been checked, if not, check it and click Modify.
    2. Remove the hidden .vs, bin and obj folders in your solution/project folder and rebuild your project in VS.

    Please feel free to let us know if this issue disappears.

    Best Regards,

    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.

    7 people found this answer helpful.

8 additional answers

Sort by: Most helpful
  1. Nick Smith 145 Reputation points
    2023-03-28T20:15:23.19+00:00

    My solution was following this:

    https://stackoverflow.com/a/66128116/1914414

    "Before you try a manual install, I'd check if the Path in the system's environment variables is correctly configured for your system.

    Given that there's always one shared host that moves forward, it will either pick the x86 or the x64 version on your machine. This issue of not picking the right one might happen if you install multiple/different versions.

    Run the where.exe dotnet command to see where the host is looking for the SDK (it's the first entry returned). If you're on a x64 machine, you want to have C:\Program Files\dotnet listed first.

    If it's not, edit the Path system's environment variable to have the location you want showing up higher. Doing that should fix the issue of the SDK versions you installed not showing up when you run dotnet --info.

    See The latest installed .NET SDK not found for complete instructions."

    The order of the SDK paths were incorrect. Reinstalling just threw the path to the bottom of the system environment path variable. Possibly due to Microsoft Studio Code being installed first onto the computer?

    29 people found this answer helpful.

  2. Hariharan 30 Reputation points
    2023-06-02T13:32:04.0366667+00:00
    5 people found this answer helpful.

  3. Akshay Chugh 5 Reputation points
    2023-12-08T09:25:02.15+00:00

    Simply moving the dotnet 64 bit path above the dotnet x86 bit path solved it for me: enter image description here

    1 person found this answer helpful.

  4. Jagged 0 Reputation points
    2023-03-24T09:40:27.0133333+00:00

    In case this helps anyone. I have parallels running on a macbook M1 ARM64 processor

    I had VS 2022 Preview installed as well as dotnet version 5

    I installed the general release VS 2022 and was receiving the error above when trying to open existing projects. I also got the same message for 'Microsoft.NET.Sdk.Web'. If I created a new project I would see the solution but not project was listed inside the solution

    I tried to solve by repairing, directly installing the SDKs but could not get it to work. I had left the preview version installed on my machine not thinking it could be the culprit

    Finally I uninstalled vs entirely from my machine as well as all SDKs. I made sure all references to .net were removed from my path and reinstalled vs 2022 ARM64 general release. It worked and I no longer have the above issues

    Hopefully this helps someone

    0 comments No comments