I ran the templates from AzureAD/microsoft-identity-web for Razor Pages:
dotnet new webapp2 --auth IndividualB2C
Which created a project using
// 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();
}
But I looked into the .csproj file and saw:
<ItemGroup>
<PackageReference Include="Microsoft.Identity.Web" Version="0.1.2-preview"/>
<PackageReference Include="Microsoft.Identity.Web.UI" Version="0.1.2-preview"/>
</ItemGroup>
So I upgraded them as it looks like the new version for Microsoft.Identity.Web was GA'd at 1.0.0. Now the line:
services.AddSignIn(Configuration, "AzureAdB2C");
Has this error:
'IServiceCollection' does not contain a definition for 'AddSignIn' and no accessible extension method 'AddSignIn' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)
The
services.AddSignIn()
is available in the nuget package ofMicrosoft.Identity.Web
up to version0.1.5 Preview
version, the above versions don't contain theservices.AddSignIn()
.Please go through the release notes of
Microsoft.Identity.Web
.With the Current version 1.1.0 you can replace
services.AddSignIn()
withservices.AddMicrosoftIdentityWebAppAuthentication()