3

我从AzureAD/microsoft-identity-web为 Razor Pages 运行了模板:

dotnet new webapp2 --auth IndividualB2C

哪个创建了一个项目使用

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddSignIn(Configuration, "AzureAdB2C");
        services.AddRazorPages()
                .AddMicrosoftIdentityUI();
    }

但我查看了 .csproj 文件并看到:

  <ItemGroup>
    <PackageReference Include="Microsoft.Identity.Web" Version="0.1.2-preview"/>
    <PackageReference Include="Microsoft.Identity.Web.UI" Version="0.1.2-preview"/>
  </ItemGroup>

所以我升级了它们,因为它看起来像Microsoft.Identity.Web 的新版本是 1.0.0 的 GA'd。现在这一行:

services.AddSignIn(Configuration, "AzureAdB2C");

有这个错误:

“IServiceCollection”不包含“AddSignIn”的定义,并且找不到接受“IServiceCollection”类型的第一个参数的可访问扩展方法“AddSignIn”(您是否缺少 using 指令或程序集引用?)

4

1 回答 1

2

最高版本的services.AddSignIn()nuget 包中可用,以上版本不包含.Microsoft.Identity.Web0.1.5 Previewservices.AddSignIn()

请仔细阅读 的发行Microsoft.Identity.Web说明。

使用当前版本 1.1.0,您可以替换services.AddSignIn()services.AddMicrosoftIdentityWebAppAuthentication()

于 2020-10-07T16:00:17.913 回答