'IServiceCollection'不包含使用服务时'AddSignIn'的定义。从模板添加登录(配置,"AzureAdB2C")



我从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发布的。现在的线路:

services.AddSignIn(Configuration, "AzureAdB2C");

出现以下错误:

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

services.AddSignIn()Microsoft.Identity.Web的nuget包中可用,最高版本为0.1.5 Preview,以上版本不包含services.AddSignIn()

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

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

最新更新