core icon indicating copy to clipboard operation
core copied to clipboard

The SDK 'Microsoft.NET.Sdk.Web' specified could not be found

Open DarioSulser opened this issue 3 years ago • 9 comments

The SDK 'Microsoft.NET.Sdk.Web' specified could not be found

Fresh Installation of https://docs.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio-code caused problems to mine by "The SDK 'Microsoft.NET.Sdk.Web' specified could not be found"

.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.7 Microsoft.NETCore.App 3.1.7 Microsoft.WindowsDesktop.App 3.1.7

.NET Core SDKs installed: 3.1.401

VS Code: VSCodeUserSetup-x64-1.48.0

May it's because I'm using Windows and previously used .net 3.1.4.? But I uninstalled all properly (with Windows deinstalations) so after Restart and installatio of all like mentioned above, it shoud work, or? not even dotnet new mvc runs properly and was not able to run because The SDK 'Microsoft.NET.Sdk.Web' specified could not be found. Thx for Fixing These on newest Version.

^^lg

DarioSulser avatar Aug 14 '20 15:08 DarioSulser

The Prolem starts if you hit Step2 in https://docs.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio-code#enhance-the-app So it seams to be a OmniSharp and it's settings.json caused mess. But why ist not mentioned enywhere that this is now a bug that you need to fix yourself bevore the C#Extension can build it?

So the fix: if you have same problem: Open Preferences->Settings on VS Code, search for omnisharp.path and Edit in settings.json: last line: "omnisharp.path": "latest"

and than you finally can start uld your app how ist i the tutorial written or use dotnet new mvc --auth Individual -o projectname and other stuff :=)

@Devs: Please fix these bug (may ist only for Windows, bevause the installer or uninstaller not check that specific settings.json - but really, please fix it becouse it can take you time to think about that it's still not workig with the latest Version^^lg

DarioSulser avatar Aug 14 '20 15:08 DarioSulser

I have the same but on Ubuntu 20.04.1 LTS (also installed everything fresh today)

"Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found"

  1. Installed VS code
  2. Installed .NET Core SDK 3.1.401
  3. Added C# extension to VS code
  4. dotnet new webapi
  5. Trying to build to project results in the same error as above.

Running the project with "dotnet build" & "dotnet run" in command line outside of VS code works fine, so it seems to me a VSCode or OmniSharp issue.

lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal

dotnet --list-runtimes Microsoft.AspNetCore.App 3.1.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

dotnet --list-sdks 3.1.401 [/usr/share/dotnet/sdk]

dotnet restore Determining projects to restore... All projects are up-to-date for restore.

dotnet build Microsoft (R) Build Engine version 16.7.0-preview-20360-03+188921e2f for .NET Copyright (C) Microsoft Corporation. All rights reserved.

Determining projects to restore... All projects are up-to-date for restore. webapi -> webapi.dll

Build succeeded. 0 Warning(s) 0 Error(s)

Time Elapsed 00:00:00.83

dotnet run info: Microsoft.Hosting.Lifetime[0] Now listening on: http://localhost:5000 info: Microsoft.Hosting.Lifetime[0] Now listening on: https://localhost:5001 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production info: Microsoft.Hosting.Lifetime[0]

dennisvanderpool avatar Aug 14 '20 17:08 dennisvanderpool

I had the same problem. To fix it I added env variable: MSBuildSDKsPath to value depending on you .NET SDK version for me it was C:\Program Files\dotnet\sdk\5.0.100-preview.7.20366.6\Sdks

Siberis avatar Aug 23 '20 05:08 Siberis

@mairaw do you own the vs code tutorial, or do you know who can help?

carlossanlop avatar Nov 06 '20 19:11 carlossanlop

Nope - I only own things under dotnet.microsoft.com. @tdykstra owns that doc.

mairaw avatar Nov 06 '20 21:11 mairaw

This is a web (ASP.NET Core) issue -- @Rick-Anderson

tdykstra avatar Nov 06 '20 21:11 tdykstra

@DarioSulser mentioned this article: https://docs.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio-code

mairaw avatar Nov 06 '20 22:11 mairaw

For Visual Studio, use the Report a Problem gesture or Suggest a Feature gesture within VS, which open internal issues for the VS team.

Rick-Anderson avatar Nov 06 '20 22:11 Rick-Anderson

I'm using VS2019 and I had tried so many "fixes" for this and nothing worked: Forcing the path setting, adding a global.json setup, changing the SDK name in the csproj... to no avail. What finally fixed this issue (for me) was removing the VS2017 Build Tools through the Visual Studio Installer Wizard. It seems any leftovers related to VS2017 was just buggy.

GuildOfCalamity avatar Apr 15 '22 14:04 GuildOfCalamity