安装Microsoft.AspnetCore.Authentication.AzureADB2C.UI后无法加载Microsoft.AspNetCore.Razor.Runtime

问题描述 投票:0回答:2

我有一个简单的AspNet Core3.1.1Web应用程序,该应用程序可以编译并运行良好。可以说,除了自定义HTML和CSS之外,此网站是使用Visual Studio模板创建的即用型项目。

唯一添加的nuget程序包是BuildWebCompiler 1.12.394-并不是最新的,尽管我已尝试更新到最新的程序,并且它不会影响随后的问题。

如果我安装nuget软件包Microsoft.AspNetCore.Authentication.AzureADB2C.UI 3.1.1,则所有内容都可以继续正常编译。但是,我在Startup.ConfigureServices期间遇到以下异常:

System.IO.FileNotFoundException
  HResult=0x80070002
  Message=Could not load file or assembly 'Microsoft.AspNetCore.Razor.Runtime, 
  Version=3.1.1.0, 
  Culture=neutral, 
  PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
  Source=<Cannot evaluate the exception source>
  StackTrace:<Cannot evaluate the exception stack trace>

除nuget安装外,项目内的代码或设置均未更改。引发异常的代码是:

public void ConfigureServices(IServiceCollection services)
{
   services.AddRazorPages(); // <--- throws
   services.AddServerSideBlazor();
}

我戳了一下,发现该文件未找到与Core 3.1.x相关的多个程序集的异常,但没有特别提及Razor.Runtime

[nu]是Microsoft.AspNetCore.Razor.Runtime,但其版本为2.2.0。无论如何,安装似乎没有帮助。

c# asp.net-core .net-assembly azure-ad-b2c razor-pages
2个回答
1
投票

这是一个已知问题。您可以跟踪相关的线程herehere。那是因为您更新了NuGet软件包,但尚未安装3.1.1运行时。

所以您可以尝试以下两种方式:

  • Microsoft.AspNetCore.Authentication.AzureADB2C.UI降级为3.1.0
  • 使用Microsoft.AspNetCore.Authentication.AzureADB2C.UI版本3.1.1但升级到SDK 3.1.101

参考:3.1.101


0
投票

使用https://github.com/dotnet/aspnetcore/issues/18334#issuecomment-581183460似乎可以解决问题。

我尚未调查原因。

© www.soinside.com 2019 - 2024. All rights reserved.