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

no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'. #53671

Closed
1 task done
shravs21ani opened this issue Jan 28, 2024 · 2 comments
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved

Comments

@shravs21ani
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Describe the bug
I have an ASP.NET Core 8 app that mostly uses Blazor WebAssembly with razor views that connects with API written in .NET 8 and fetch data from Cosmos DB.
I am facing the TargetFramework issue, and I am not doing any code changes, the Blazor pages stopped working correctly.
As project itself is not building.
Error Message: Severity Code Description Project File Line Suppression State
Error NETSDK1082 There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'. WasmNew C:\Program Files\dotnet\sdk\8.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets 491

Expected Behavior

.net 8 Blazor App should run and fetch data from API.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

8.0.101

Anything else?

I am using Visual Studio 2022 .
Here is the .csproj file.
Project.csproj.docx

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Jan 28, 2024
@javiercn
Copy link
Member

@shravs21ani thanks for contacting us.

One of your dependencies (projects or dlls) is bringing in a framework reference to Microsoft.AspNetCore.App which is not supported in webassembly, you need to rework your dependencies to make sure that doesn't happen.

@javiercn javiercn added question ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. labels Jan 29, 2024
@ghost ghost added the Status: Resolved label Jan 29, 2024
@ghhv
Copy link

ghhv commented Apr 28, 2024

More simply this also occurs if you try and add a shared Razor component library to a Blazor Web App (.NET 8) with the defaults and have "Support pages and views" enabled.. Turn that off and all will be good..

If it's too late, delete the Areas folder in the RCL and in the .csproj change the following

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

to

 <ItemGroup>
   <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.x" />
 </ItemGroup>

The other extra line <AddRazorSupportForMvc>true</AddRazorSupportForMvc> doesn't seem to cause issues but add/remove to suit you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved
Projects
None yet
Development

No branches or pull requests

3 participants