.NET 6 预览版 4:Microsoft.AspNetCore.App 没有可用于指定 RuntimeIdentifier 'browser-wasm' 的运行时包

.NET 6 preview 4: There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'

我正在使用 .NET 6.0.100-preview.4.21255.9,ASP.NET Core Blazor WebAssembly 6.0.100-preview.4.21255.9。我尝试通过这种方式覆盖默认标识 UI:添加对 NuGet 包的引用]Microsoft.AspNetCore.Identity.UI](https://www.nuget.org/packages/Microsoft.AspNetCore.Identity.UI/6.0.0-preview.4.21253.5?_src=template) 但是添加此 NuGet 包时发生错误(另一个 NuGet 包没问题)

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'.    acc.Client  C:\Program Files\dotnet\sdk.0.100-preview.4.21255.9\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets 391 
Error   NETSDK1082  There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'.    acc.Client  C:\Program Files\dotnet\sdk.0.100-preview.4.21255.9\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets 391 

主要错误信息:

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

当我点击查看详细错误时,它指向

<ResolveRuntimePackAssets FrameworkReferences="@(FrameworkReference)"
                          ResolvedRuntimePacks="@(ResolvedRuntimePack)"
                          UnavailableRuntimePacks="@(UnavailableRuntimePack)"
                          SatelliteResourceLanguages="$(SatelliteResourceLanguages)"
                          DesignTimeBuild="$(DesignTimeBuild)">
  <Output TaskParameter="RuntimePackAssets" ItemName="RuntimePackAsset" />
</ResolveRuntimePackAssets>

(文件 C:\Program Files\dotnet\sdk.0.100-preview.4.21255.9\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets 。摘自 https://gist.github.com/donhuvy/d98d59e8af9947e37e6d4fe85004e444#file-microsoft-net-sdk-frameworkreferenceresolution-targets-L391-L397

如何添加NuGet包UI成功?

  • 升级到 new/latest 版本的 .NET
  • 清除网络浏览器中的缓存
  • 删除旧的 build fodlers(objbin),clean/Re-build 解决方案。