Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The SDK 'Microsoft.NET.Sdk.BlazorWebAssembly' specified could not be found. #29700

Closed
sroy2020 opened this issue Jan 27, 2021 · 7 comments
Closed
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. Status: Resolved

Comments

@sroy2020
Copy link

sroy2020 commented Jan 27, 2021

Describe the bug

I can't build using a build pipeline on an on-premise DevOps Server. So I decided to create a small project and compile manually on the same server. Unfortunately, I have the same error the build pipeline is reporting. The build fails with the following error

"C:\Users\SRoy\z\qwerty\qwerty.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk.BlazorWebAssembly' specified could not be found."

To Reproduce

I created a small Blazor WASM using the command "dotnet new blazorwasm -o qwerty". Then run "dotnet build" inside the qwerty folder. The build fails with the error above.

Exceptions (if any)

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

Further technical details

qwerty.csproj contains:

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

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.2" PrivateAssets="all" />
    <PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
  </ItemGroup>

</Project>

global.json in qwerty folder contains:

{
  "sdk": {
    "version": "5.0.102"
  }
}
C:\Users\SRoy\z\qwerty>dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.102
 Commit:    71365b4d42

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.102\

Host (useful for support):
  Version: 5.0.2
  Commit:  cb5f173b96

.NET SDKs installed:
  3.1.201 [C:\Program Files\dotnet\sdk]
  3.1.300 [C:\Program Files\dotnet\sdk]
  5.0.100 [C:\Program Files\dotnet\sdk]
  5.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
C:\Users\SRoy\z\qwerty>dotnet --list-sdks
3.1.201 [C:\Program Files\dotnet\sdk]
3.1.300 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]
5.0.102 [C:\Program Files\dotnet\sdk]

folderDotnet

I really don't have any clue what could be wrong. Doing the very same on my workstation is fine.

Thanks in advance
Stéphane Roy

@Pilchie Pilchie added the area-blazor Includes: Blazor, Razor Components label Jan 27, 2021
@javiercn
Copy link
Member

@sroy2020 thanks for contacting us.

That seems like an issue with the installation on your build machine. I would suggest you repair the installation or try downloading and using the 5.1.102 SDK binaries and use that directly. For that:

  • Download the 5.1.102 SDK as a zip file (binaries not installer)
  • Unzip the binaries into a folder on the machine.
  • Open a powershell console and setup the following environment variables:
    $env:DOTNET_ROOT = $dotNetFolder;
    $env:DOTNET_MULTILEVEL_LOOKUP = 0;
    $env:Path = "$dotNetFolder;$env:Path";
    

Where dotnet folder is the path to where you unzipped the dotnet binaries.
If you do dotnet --info after that, it should only point to that binary distribution.

Then create a new blazor webassembly application and build it. If it works, it means that there's some issue in your installation, so I would suggest reinstalling the SDK

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Jan 28, 2021
@sroy2020
Copy link
Author

Hi,

I downloaded and installed the binaries using the zip and then followed the procedure. Unfortunately, I get the same error.
Below is the output captured in text and as a screenshot.

Do you have any other recommendations?

Thanks in advance
Stéphane Roy

PS C:\Users\SRoy> cd x
PS C:\Users\SRoy\x> $env:DOTNET_ROOT = "C:\Tmp\dotnet-sdk-5.0.102-win-x64"
PS C:\Users\SRoy\x> $env:DOTNET_MULTILEVEL_LOOKUP = 0;
PS C:\Users\SRoy\x> $env:Path = "C:\Tmp\dotnet-sdk-5.0.102-win-x64;$env:Path";
PS C:\Users\SRoy\x> ls
PS C:\Users\SRoy\x> dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.102
 Commit:    71365b4d42

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Tmp\dotnet-sdk-5.0.102-win-x64\sdk\5.0.102\

Host (useful for support):
  Version: 5.0.2
  Commit:  cb5f173b96

.NET SDKs installed:
  5.0.102 [C:\Tmp\dotnet-sdk-5.0.102-win-x64\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.2 [C:\Tmp\dotnet-sdk-5.0.102-win-x64\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.2 [C:\Tmp\dotnet-sdk-5.0.102-win-x64\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 5.0.2 [C:\Tmp\dotnet-sdk-5.0.102-win-x64\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
PS C:\Users\SRoy\x> dotnet new blazorwasm -o qwerty
The template "Blazor WebAssembly App" was created successfully.
This template contains technologies from parties other than Microsoft, see https://aka.ms/aspnetcore/5.0-third-party-notices for details.

Processing post-creation actions...
Running 'dotnet restore' on C:\Users\SRoy\x\qwerty\qwerty.csproj...
Restore succeeded.

PS C:\Users\SRoy\x> ls


    Directory: C:\Users\SRoy\x


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        1/28/2021   1:46 PM                qwerty


PS C:\Users\SRoy\x> cd .\qwerty\
PS C:\Users\SRoy\x\qwerty> dotnet build
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Users\SRoy\x\qwerty\qwerty.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk.BlazorWebAssembly' specified could not be found.

Build FAILED.

C:\Users\SRoy\x\qwerty\qwerty.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk.BlazorWebAssembly' specified could not be found.
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.23
PS C:\Users\SRoy\x\qwerty>

dotNetPS

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Jan 28, 2021
@javiercn
Copy link
Member

@sroy2020 thanks for the additional details.

@pranavkm do you know what can be going on here?

@pranavkm
Copy link
Contributor

There's a couple of SDK issues for this error code: dotnet/sdk#10229, dotnet/msbuild#2532. Can you look at the solutions posted in these issues to see if it helps?

@sroy2020
Copy link
Author

Hi,

I can't believe it. Using the info from dotnet/sdk#10229. I found out that the env. var. MSBuildSDKsPath was set to a previous SDK. I updated it to "C:\Program Files\dotnet\sdk\5.0.102\Sdks" and now "dotnet build" is fine.

Thanks to all

@pranavkm pranavkm added the ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. label Jan 28, 2021
@ghost ghost added the Status: Resolved label Jan 28, 2021
@ghost
Copy link

ghost commented Jan 29, 2021

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.

@ghost ghost closed this as completed Jan 29, 2021
@HarrisonOfTheNorth
Copy link

Although seemingly resolved on Windows, I am getting this same original bug on Mac.

Checking the $PATH, I get:

echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands

The project builds properly if built in Visual Studio, however not using the command line.

My specific error is:

error MSB4236: The SDK 'Microsoft.NET.Sdk.BlazorWebAssembly' specified could not be found.

and yet the path to the SDK is: /usr/local/share/dotnet/sdk/5.0.102/Sdks/Microsoft.NET.Sdk.BlazorWebAssembly

@ghost ghost locked as resolved and limited conversation to collaborators Mar 8, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. Status: Resolved
Projects
None yet
Development

No branches or pull requests

5 participants