aspnet / Tooling

Issue tracker and info on Visual Studio tooling for ASP.NET
Other
258 stars 124 forks source link

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

Closed MiaomiaoHuangfu closed 7 years ago

MiaomiaoHuangfu commented 7 years ago

Create an ASP .NET Core Web Application (.NET Core) project prompting a window: "The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.". microsoft net sdk webnotfound

Test on d15prerel.26526.3002 OS: Windows 10 X64

mlorbetske commented 7 years ago

This should be fixed in later builds of d15prerel. @MiaomiaoHuangfu please file these in TFS or on https://github.com/aspnet/websdk or https://github.com/dotnet/templating rather than on this repo. We're moving toward this repo being used for feature requests/discussions & trying to move away from tracking product issues here (especially for internal builds)

robertmclaws commented 7 years ago

So, it's great that the issue is fixed in later builds, but if I'm outside Microsoft and don't have access to newer builds, how do I fix it?

Thanks!

davidfowl commented 7 years ago

This issue was reported on an internal build to begin with. If you're seeing the issue it might be something completely different, or it might have been a bug in the preview that you can't work around.

What exactly are you seeing?

robertmclaws commented 7 years ago

The exact same error message and dialog on VS2017.3 Preview 3. I had a .NET Core web project open and was working fine, I restarted my machine, and then it was broken. I tried repairing the .NET Core SDK, uninstalling and reinstalling, neither of which had any effect. I needed to get back to work, so I'm trying a VS repair and seeing if that fixes it.

mlorbetske commented 7 years ago

Could you check your PATH environment variable to see if there are entries for a dotnet directory under both Program Files and Program Files (x86) please? If there are two entries, could you move the Program Files one to be before the Program Files (x86) one, restart Visual Studio and see if that helps please?

robertmclaws commented 7 years ago

Hmm, there are actually NO PATH entries for dotnet anymore, even after repairing both the SDK and VS2017.3.

What are they supposed to be?

robertmclaws commented 7 years ago

OK, it's supposed to be C:\Program Files\dotnet\ (as found on another machine). Adding it back to the PATH and restarting VS solved the problem.

natemcmaster commented 6 years ago

We got another report of this issue in latest preview builds of VS. https://github.com/aspnet/Home/issues/2113. For some reason, this error only applies to projects with Microsoft.NET.Sdk.Web. Other non-web Microsoft.NET.Sdk projects from the same solution load fine.

aKabirKhan commented 6 years ago

Any update on this, we are stuck since code analysis is only working after 2015.3 preview 2 and installing preview 6 breaks the sln with error mentioned above.

kspearrin commented 6 years ago

This just happened to me. .NET Core 2.0 installed under X64 (Program File\dotnet). My path was set to Program Files (x86)\dotnet. Changing path to Program File\dotnet solved the problem.

aKabirKhan commented 6 years ago

I tried installing the .net core 2.0 again and check the env var for both user and system they are accurate(c:\Program File\dotnet). But still cannot open the project. Below is my project that fail to load


<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <DebugType>Full</DebugType>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170502-03" />
    <PackageReference Include="Microsoft.CodeCoverage" Version="1.0.3" />
    <PackageReference Include="Moq" Version="4.7.25" />
    <PackageReference Include="xunit" Version="2.2.0" />
    <PackageReference Include="xunit.extensibility.execution" Version="2.2.0" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\src\...\...Api.csproj" />
    <ProjectReference Include="..\..\src\...\....Repository.csproj" />
    <ProjectReference Include="..\..\src\...\....csproj" />
  </ItemGroup>

  <ItemGroup>
    <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
  </ItemGroup>

  <ItemGroup>
    <None Include="appsettings.json" CopyToOutputDirectory="Always" />
  </ItemGroup>

</Project>
calebp commented 6 years ago

I experienced this issue with VS2017 Preview 3 and an Azure Functions project (attempting to create an Azure Function from a class library). None of the path alterations mattered, nor did a VS2017 "repair" - but removing the sdk property entirely from a several-directories-upstream global.json file (universal for a very large codebase) resolved a similar error (project wouldn't load, error message was 'unable to find Microsoft.Net.SDK.Publish').

barrytang commented 6 years ago

@calebp

To report new issues, use the Report a Problem tool. The GitHub Issue Tracker for the aspnet/Tooling repo is now deprecated in favor of the Report a Problem tool.

If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks. See here for more details.

ghost commented 6 years ago

"My path was set to Program Files (x86)\dotnet. Changing path to Program File\dotnet solved the problem." - How check my current path and change it to another one ?

sandykulk commented 6 years ago

Any update on this issue. I have set the path to "c:\Program File\dotnet" but still cannot open the project.

ghost commented 6 years ago

I figure it out.

  1. Remove all .net core frameworks from your computer.
  2. Install .net core 2.0
  3. add global.json to your project and point sdk 2.0.0

{ "projects": [], "sdk": { "version": "2.0.0" } }

Additional info

Visual Studio 2017 Community Update 3 -> Version 15.3.3 In your dotnet core web application .csproj leave: Microsoft.NET.Sdk.Web !

You can check info by typing dotnet --info in CMD

brijmcq commented 6 years ago

@letsgoforaride guide works well. In my case, I didn't need to remove all previous .net core frameworks, I just did the step 3, just updating the sdk to 2.0.0 in global.json and voila

barrytang commented 6 years ago

Adding @livarcocc who owns the .NET Core CLI as FYI.

cbassigit commented 6 years ago

Step 3 from @letsgoforaride guide work for me as well. There was no need to remove previous frameworks. I had to create global.json file but it worked great (1st .net core project for me).

brijmcq commented 6 years ago

There is actually a good guide on this https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/, but I think they should include what kind of errors you will be getting if you don't follow the migration guide.

donsartain commented 6 years ago

I'm having the same problem, without VS 2017 installed.

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

global.json

{ "projects":[], "sdk": { "version": "2.0.0" } }

manish-jain-1 commented 6 years ago

Still happening on VS2017 15.3.5 + core 2.0. tried all above solutions.

lalalaring commented 6 years ago

Still happening on VS2017 15.4.0 + core 2.0. tried all above solutions.

CDuke commented 6 years ago

I had the same problem on VS2017 15.4.0 + core 2.0. I'm repair .NET Core SDK 2.0.2 and restart Visual Studio. After that problem gone.

kikomi commented 6 years ago

Had this problem with VS2017 15.4.0 + .NET Core 2.0 Solved with installation of proper version of .NET Core SDK i.e. version of .NET Core SDK (x86/x64) has to much version of Visual Studio.

lalalaring commented 6 years ago

VS2017 15.4.0 + .NET Core 2.0,Solved with change dotnet path from system path to user path

ghost commented 6 years ago

Changing the PATH Environment variable from C:\Program Files(x86)\dotnet to C:\Program Files\dotnet fixed the problem.

YuriyZaletskyy commented 6 years ago

Neither adding global.json, nor adding for user path: C:\Program Files\dotnet\ didn't solve the problem for me.

Alex61NN5 commented 6 years ago

Still not working, none of the above solved for me

barrytang commented 6 years ago

To report new issues, use the Report a Problem tool. The GitHub Issue Tracker for the aspnet/Tooling repo is now deprecated in favor of the Report a Problem tool.

If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks. See here for more details.

MarcosRZ commented 4 years ago

This is NOT a new Issue.

Note the 2.1.802 SDK version below.

$ dotnet --version
2.1.802
$ dotnet --info
SDK de .NET Core (reflejando cualquier global.json):
 Version:   2.1.802
 Commit:    177d0b2525

Entorno de tiempo de ejecuci▒n:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.802\

Host (useful for support):
  Version: 2.1.13
  Commit:  1a165a1588

.NET Core SDKs installed:
  2.1.802 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspN                                                                                                                                                                                               etCore.All]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspN                                                                                                                                                                                               etCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore                                                                                                                                                                                               .App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Could you PLEASE explain us how to solve this old issue? In my case, upgrading the SDK version is not an option.