Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blazor Client - error NETSDK1082: 'browser-wasm'

I created a simple blazor wa project hosted option selected. In the client side of the project in the project it automatically comes with <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">. I then added a few nuget packages before writing any code and when I clean the solution and even rebuild the solution it gives me the error:

error NETSDK1082: There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'.

I looked it up and saw that one solution to this is to change the first line in the .csproj to <Project Sdk="Microsoft.NET.Sdk.Web"> instead of what it comes with by default. I did so but then when I run just the client it says 404. Then if I remove the extra packages and put it back to the default sdk it works. Is there a reason why I am getting this error with those packages? I created a blazor wa hosted .net 6 project btw.

my client.csproj

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

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Blazored.LocalStorage" Version="4.1.5" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.12" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Components.ProtectedBrowserStorage" Version="5.0.0-rc.1.20451.17" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0" PrivateAssets="all" />
    <PackageReference Include="Microsoft.Identity.Web" Version="1.21.0" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
    <PackageReference Include="RestSharp" Version="106.13.0" />
  </ItemGroup>

  
</Project>
like image 836
MarkCo Avatar asked May 03 '26 19:05

MarkCo


1 Answers

Not just .csproj but also check project.assets.json . Usually the culprit is the non web assembly compatible packages. The easier way is to check your NuGet dependencies and verify if your third party packages are compatible with WebAssembly

https://github.com/dotnet/aspnetcore/issues/36711#issuecomment-922801873

like image 194
Mayur Ekbote Avatar answered May 05 '26 09:05

Mayur Ekbote



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!