Setting IdentityUIFrameworkVersion>Bootstrap4</IdentityUIFrameworkVersion
First suggested method: Adding <IdentityUIFrameworkVersion>Bootstrap4</IdentityUIFrameworkVersion> to PropertyGroup did not solved the problem. Is there anything missing in this aproach? Migrating to Boostrap 5 is not possible at this time. Thanks
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 1e7a18c8-acae-f101-fcbd-f3b79f4e7c9f
- Version Independent ID: 266e32ee-567e-f8dd-7da8-e82c277aab1c
- Content: Breaking change: Default version of Bootstrap used with Identity now 5 - .NET
- Content Source: docs/core/compatibility/aspnet-core/6.0/identity-bootstrap4-to-5.md
- Product: dotnet-fundamentals
- GitHub Login: @serpent5
- Microsoft Alias: gewarren
@haok or @Rick-Anderson Can you help with this issue?
First suggested method: Adding Bootstrap4 to PropertyGroup did not solved the problem.
Can you create the simplest possible repo that demonstrates this problem? Create a RP o MV app with individual user accounts using the 5.0 templates. Add
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IdentityUIFrameworkVersion>Bootstrap4</IdentityUIFrameworkVersion>
</PropertyGroup>
Also did you scaffold out any/all of the identity UI pages?
Hi, The article did not mention the need to scaffold out any/all of the identity UI pages, did it? Can you elaborate here? But in my case this was a NET 5 project. The identity UI pages were scaffolded using the 5 templates (That's why the Boostrap version is 4). On top of that all the UI pages have been worked on to show a real app looked. Re-scaffolding them means recreating the pages again.
After setting the property to boostrap4, can you double check via F12 on one of your identity pages, after forcing a reload of all the resources, that the bootstrap assets you are getting from identity ui are bootstrap 5 or 4?
Hi Haok, The application does not start: Unhandled exception. Here is the error. System.InvalidOperationException: Found an invalid value for the 'IdentityUIFrameworkVersion'. Valid values are 'Bootstrap4', 'Bootstrap3' at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.TryResolveUIFramework(Assembly assembly, UIFramework& uiFramework) at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.<>c__DisplayClass2_0.<AddRelatedParts>b__0(ApplicationPartManager partManager) at Microsoft.Extensions.DependencyInjection.MvcCoreMvcBuilderExtensions.ConfigureApplicationPartManager(IMvcBuilder builder, Action`1 setupAction)
Here is the project file used to build it:
`<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net6.0 </TargetFramework> <IdentityUIFrameworkVersion>Bootstrap4 </IdentityUIFrameworkVersion> <UserSecretsId>aspnet-MyTest-x...x </UserSecretsId> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.7" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.7" /> <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.7" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.7" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.7" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.7"> <PrivateAssets>all </PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive </IncludeAssets> </PackageReference> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.7" /> </ItemGroup> <ItemGroup> <Folder Include="Extensions\" /> </ItemGroup> </Project>
That error message seems to point at the problem, are you sure you are running against 6.0? It should only support Bootstrap5 and Bootstrap4
That said, we only guarantee this works against the non scaffolded identity UI, if you replaced/scaffolded pages, you should be able to directly update your links in your pages, and point back to boostrap4 on any pages you scaffolded out
Hi Haok,
In regards to your first question:
Wouldn't the following line guarantee it is running against 6.0?
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net6.0 </TargetFramework>
Second questions. I will try to answer:
The identity UI pages were originally scaffolded using the core 5 templates. I updated the target framework and packages to version 6. UI pages were not re-scaffolded again.
I hope this helps understand.
Can you create a repro project and upload it to a git so I can see the behavior for myself and investigate?
Can you create a repro project and upload it to a git so I can see the behavior for myself and investigate?
Create the simplest possible project.
Hi Yes, let me have a simple project. FYI. It works in my local host, but it throws the error at my hosted enviroment. I have confirmed core 6 is installed.
Hi. This is the simple repo with @alexisconsuegra 's issue: https://github.com/bcons009/netcore-demo5
Hi @Rick-Anderson Have you been able to check the repo Bryan created for this issue?
@alexisconsuegra I create an ASP.NET Core MVC project with individual user accounts using .NET 5, then I updated the project settings with the following:
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IdentityUIFrameworkVersion>Bootstrap4</IdentityUIFrameworkVersion>
<UserSecretsId>aspnet-WebApplication1-66EF50D6-BDA8-4633-8B19-2CB038E9DA15</UserSecretsId>
</PropertyGroup>
And it worked as expected. F12 tools shows it's using Bootstrap4
I guess the work around only works in localhost. FYI. Locally works for me too, but not in the hosted enviroment.
https://webbootstrap44.azurewebsites.net/ Works fine deployed too.