0
votes

If I use Nuget "Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.0" with .Net 5.0 blazor webassembly I get the following error on clean: NETSDK1082 There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'.

I created a brand new blazor webassembly .Net 5.0 project as in the below project file. The issue occurs when I include an openidconnect reference, but disappears if I delete that reference.

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

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.0" PrivateAssets="all" />
    <PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
  </ItemGroup>

</Project>
2
I have tried starting a new blazor webassembly .Net 5.0 project and can reproduce the issuePatMac

2 Answers

0
votes

You can try to change your project file to below:

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

<PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
    <UseBlazorWebAssembly>true</UseBlazorWebAssembly>
</PropertyGroup>

If it doesn't work,you can see more details in this thread.

0
votes

Your question is not related to OpenIddict and is caused by the fact you're trying to reference a package - Microsoft.AspNetCore.Authentication.OpenIdConnect - that you're not supposed to use on Blazor.

It's a pure server-side package that CAN'T work on Blazor, which has its own OIDC authentication stack: https://www.nuget.org/packages/Microsoft.AspNetCore.Components.WebAssembly.Authentication/