3
votes

I created a new asp.net core web application which uses individual user accounts. And I want to allow users to sing-in using their Microsoft accounts. so i tried following this tutorial https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/microsoft-logins?view=aspnetcore-2.2.. but when i tried adding this inside our startup.cs :-

 services.AddDefaultIdentity<IdentityUser>()
        .AddDefaultUI(UIFramework.Bootstrap4)
        .AddEntityFrameworkStores<ApplicationDbContext>();

            services.AddAuthentication().AddMicrosoftAccount(microsoftOptions =>
            {
                microsoftOptions.ClientId = Configuration["Authentication:Microsoft:ApplicationId"];
                microsoftOptions.ClientSecret = Configuration["Authentication:Microsoft:Password"];
            });

I got this error:-

Error CS0103 The name 'UIFramework' does not exist in the current context

so i am not sure how i can add a referecne to UIFramework? thanks

2
Which version of ASP.NET Core are you targetting? - Kirk Larkin
@Kirk Larkin I am using .NET Core 2.1 inside VS 2017.. - John John
That's your issue - UIFramework was added in 2.2. - Kirk Larkin
@Kirk Larkin so should i upgrade the .NET core? i just installed VS 2017 and i just created the new project,, so i would assume that i should have the latest version of .net core.. - John John
That's up to you - 2.1 is LTS but 2.2 is the latest. You might not have the latest .NET Core SDK installed. - Kirk Larkin

2 Answers

6
votes

For .NET Core 3 developers:

(A breaking change)

For bootstrap 4 use: .AddDefaultUI(); For bootstrap 3 use: .AddDefaultUI(); and then override the version by adding

<IdentityUIFrameworkVersion>Bootstrap3</IdentityUIFrameworkVersion>

inside your project file. See: https://github.com/aspnet/Announcements/issues/380

1
votes

UIFramework was added in .NEt Core 2.2 you can upgrade from .NEt Core 2.1 to 2.2 Or just delete this .AddDefaultUI(UIFramework.Bootstrap4)