我从AzureAD/microsoft-identity-web运行了剃刀页面的模板:
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 was GA'd at 1.0.0的新版本。现在是这样的:
services.AddSignIn(Configuration, "AzureAdB2C");出现以下错误:
“IServiceCollection”不包含“AddSignIn”的定义,并且找不到接受类型为“IServiceCollection”的第一个参数的可访问扩展方法“AddSignIn”(是否缺少using指令或程序集引用?)
发布于 2020-10-08 00:00:18
Microsoft.Identity.Web的nuget包中提供了0.1.5 Preview版本之前的services.AddSignIn(),以上版本不包含services.AddSignIn()。
请通过Microsoft.Identity.Web的release notes。
在当前版本1.1.0中,您可以用services.AddMicrosoftIdentityWebAppAuthentication()替换services.AddSignIn()
https://stackoverflow.com/questions/64201409
复制相似问题