dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.39k stars 10k forks source link

Adding Microsoft.AspNetCore.Identity.UI to .Net 6 Blazor Webassembly Shared project causes build Error #39263

Closed patrickwensel closed 2 years ago

patrickwensel commented 2 years ago

Is there an existing issue for this?

Describe the bug

When I add a reference to Microsoft.AspNetCore.Identity.UI to the Shared project, I get the following error:

Error NETSDK1082 There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'. WaterWithdrawl.Client C:\Program Files\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets 427

I did not change anything from the Visual Studio .Net 6 Blazor Assemble Template

Expected Behavior

Build without errors

Steps To Reproduce

Create a new Blazor Webassembly App

image

image

Authentication Type: Individual Accounts

image

Add Microsoft.AspNetCore.Identity.UI to Shared Project

image

Build

image

Exceptions (if any)

No response

.NET Version

6.0

Anything else?

No response

patrickwensel commented 2 years ago

I was trying to move my ApplicationUser object to my Shared project. Microsoft.AspNetCore.Identity.UI is not needed to reference Identity in the Shared project, you only need Microsoft.AspNetCore.Identity.EntityFrameworkCore. Do you want to close this?

hoseinprg commented 2 years ago

You need to update your projects to use the below SDK's : Client - Microsoft.NET.Sdk.BlazorWebAssembly Server - Microsoft.NET.Sdk.Web Shared - Microsoft.NET.Sdk

look at this:👇 https://github.com/dotnet/aspnetcore/issues/27738

patrickwensel commented 2 years ago

I am ok with you closing the issue because there was a simple solution but the article you sent did not seem to address the issue. There will be other people in the future that have this same issue because of the reference confusion and I think a better answer would be helpful to those having the same confusion I did than referencing a ticket that was unrelated.

pranavkm commented 2 years ago

Identity UI depends on the ASP.NET Core shared framework that cannot be referenced from a blazor wasm app. By adding it to the shared project, you're adding a transitive reference to the ASP.NET Core shared framework which is what produces the error.