Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4048

Blazor WASM .NET 9 - NETSDK1082 Error: No runtime pack

$
0
0

I am working on a Blazor web assembly project with multiple projects in a single solution. However, when I try to build the solution using dotnet build, I get the following error:

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

Project structure (.sln)

I have four projects in my solution:

  1. RazorClassLibrary (shared components)
  2. TraningBlazorAPIProject (ASP.NET Core Web API)
  3. TraningBlazorProject (Blazor server, acts as the main entry point)
  4. TraningBlazorProject.Client (Blazor web assembly frontend)

TraningBlazorProject.Client.csproj (Blazor web assembly):

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"><PropertyGroup><TargetFramework>net9.0</TargetFramework><RuntimeIdentifier>browser-wasm</RuntimeIdentifier><ImplicitUsings>enable</ImplicitUsings><UseBlazorWebAssembly>true</UseBlazorWebAssembly><Nullable>enable</Nullable><StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode></PropertyGroup><ItemGroup><PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.3" /><PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="9.0.3" /><PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.3" /></ItemGroup></Project>

TraningBlazorProject.csproj (Blazor server)

<Project Sdk="Microsoft.NET.Sdk.Web"><PropertyGroup><TargetFramework>net9.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings></PropertyGroup><ItemGroup><ProjectReference Include="..\RazorClassLibrary\RazorClassLibrary.csproj" /><ProjectReference Include="..\TraningBlazorProject.Client\TraningBlazorProject.Client.csproj" /><PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.3" /></ItemGroup></Project>

Error details

TraningBlazorProject.Client failed with 1 error(s)
C:\Program Files\dotnet\sdk\9.0.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(512,5): error NETSDK1082: There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'.

Troubleshooting steps I tried (but didn't work):

  1. Checked for FrameworkReference in TraningBlazorProject.Client.csproj. Verified that Microsoft.AspNetCore.App is not referenced in the web assembly project.

  2. Removed ProjectReference from TraningBlazorProject.csproj to TraningBlazorProject.Client.csproj.

    Since Blazor web assembly should not be directly referenced by Blazor server, I temporarily removed it and tried building again, but the error persisted.

  3. Reinstalled .NET workloads
    Ran:

    dotnet workload uninstall wasm-toolsdotnet workload install wasm-toolsdotnet workload repair

    But I'm still getting the same error.

  4. Cleared NuGet caches and restored packages

    dotnet nuget locals all --cleardotnet restore

    Still no luck.

  5. Deleted bin and obj folders and rebuilt the project

    rd /s /q bin objdotnet cleandotnet restoredotnet build

    The error remains.

Questions:

  • Why is Blazor web assembly (browser-wasm) trying to reference Microsoft.AspNetCore.App, which is only for Blazor server?

  • Is there a conflict between TraningBlazorProject.Client (Blazor WASM) and TraningBlazorProject (Blazor server)?

  • How can I properly structure the solution to prevent this error?


Viewing all articles
Browse latest Browse all 4048

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>