How to fix error : The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.

Brayan Escamilla Reyes 5 Reputation points
2023-11-17T19:15:39.3766667+00:00

I followed this https://stackoverflow.com/questions/67049414/windows-or-visual-studio-2022-cant-find-the-latest-installed-net-sdk-due-to-bi/67049415#67049415 and I still received the same error despite restarting the application to make sure the changes were made. I also have repaired, uninstalled VS 2022 and nothing works. I also tried to Reset VS settings (From the Developer Command Prompt for Visual Studio 2022 > run devenv /ResetSettings).

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,304 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
1,068 questions
{count} vote

2 answers

Sort by: Most helpful
  1. shruthi sunke 130 Reputation points
    2024-05-31T19:49:47.86+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.

    5 people found this answer helpful.

  2. Anna Xiu-MSFT 30,291 Reputation points Microsoft Vendor
    2023-11-20T03:49:10.2733333+00:00

    Hi @Brayan Escamilla Reyes

    Welcome to Microsoft Q&A! 

    Does it occur when loading the project?

    Please try the following workarounds:

    1. Open Visual Studio Installer > Modify > Individual components > ensure that .NET SDK is installed.
    2. Uninstall outdated versions of the .NET SDK and runtime.
    3. Install the latest .NET SDK on the .NET download page.
    4. Close all running VS instances, open your project file (like .csproj for C# project) and ensure the Sdk attribute exists in the Project element:
                  <Project Sdk="Microsoft.NET.Sdk.Web"></Project>
    
    1. You can also try to replace <Project Sdk="Microsoft.NET.Sdk.Web"> with <Project Sdk="Microsoft.NET.Sdk">.
    2. Close all running VS instances and delete the hidden .vs, obj and bin folders in the project folder.
    3. You can create a new .NET-based project and check if it persists. 

    Sincerely,

    Anna


    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.

     

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.