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,821 questions
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 28,941 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.

9 additional answers

Sort by: Most helpful
  1. Nick Smith 150 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?

    30 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 20 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

    4 people found this answer helpful.

  4. shruthi sunke 15 Reputation points
    2024-05-31T19:40:31.2166667+00:00

    My experience has been the same. Instead of getting run, I see attach in VS. I created a project, but it says Microsoft SDK not found, and the projects were showing 0. I tried changing the environment variables but nothing worked, tried installing Microsoft sdk, didn't work. However, I found that one solution worked for me.

    Navigate to the file explorer > this PC > windows (C:) > Program files > dotnet, and try to locate the SDk folder here

    Now go back, select program files (x86) > dotnet (check if you have a sdk folder here). If you don't find SDK folder here, Copy the complete SDK folder from Program file's dotnet and paste it in Program files (x86)'s dotnet folder.Then launch VS and create a new project. It worked for me. Hope this helps.

    1 person found this answer helpful.
    0 comments No comments