Visual studio 2017 Update 3 - The SDK 'Microsoft.NET.Sdk.Web' specified could not be found

前端 未结 14 1009
暖寄归人
暖寄归人 2020-12-13 07:06

Error:

C:\\WebApp\\WebApp.csproj : error : The SDK \'Microsoft.NET.Sdk.Web\' specified could not be found. C:\\WebApp\\WebApp.csproj

14条回答
  •  感动是毒
    2020-12-13 07:22

    I stumbled upon this issue a number of times recently. Here's a brief list of the workaround I found (one of them always worked until now):

    1. Install the right .NET Core SDK: Either the latest version or the version required by your project.
    2. Clean-up obsolete .NET Core versions: Go to Control Panel and uninstall previous .NET Core SDK/Runtime versions (as long as you don't use them anymore).
    3. Create a Global.json file: Add a new global.json file to your project's root with the following content (replace the .NET Core version build with the one you want to run the project with):

      { "sdk": { "version": "2.0.5" } }

    4. Rename the SDK reference: Open your .proj file and replace with .

    5. Add the MSBuildSDKsPath Environment Variable: The dotnet CLI sets the MSBuildSDKsPath environment variable when invoking MSBuild: however, a December 2016 patch changed the CLI behaviour so that it will respect an existing environment variable, if it has already been set: this will allow the developer to “force” the CLI to use a specific SDK.

    6. Check your PATH: Verify that both C:\Program Files\dotnet and C:\Program Files (x86)\dotnet are in the PATH environment variable.

    For additional info regarding the issue and other viable fixes check out this blog post that I wrote on this topic.

提交回复
热议问题