[英]Custom Bootstrap 4 UI in scaffolded Identity pages broken after upgrading from .NET 5 to .NET 6
I upgraded a .NET 5 blazor server app to .NET 6 and while .NET 6 apps now use Bootstrap 5 by default, I wanted to continue using Bootstrap 4, so I did not update my css or js files under wwwroot. I upgraded a .NET 5 blazor server app to .NET 6 and while .NET 6 apps now use Bootstrap 5 by default, I wanted to continue using Bootstrap 4, so I did not update my css or js files under wwwroot.
Most of the application UI looked the same after the upgrade except for the scaffolded Identity pages that I customized with Bootstrap 4 classes.除了我使用 Bootstrap 4 类自定义的脚手架身份页面外,大多数应用程序 UI 在升级后看起来都一样。 Looking in the browser dev tools, I could see that the css being loaded for the main part of the app was Bootstrap 4 but the css being loaded for the Identity pages was Bootstrap 5 (which has breaking changes).
查看浏览器开发工具,我可以看到为应用程序的主要部分加载的 css 是 Bootstrap 4,但为身份页面加载的 css 是 Bootstrap 5(其中有重大更改)。
Microsoft announced the breaking change (moving from Bootstrap 4 to 5) here and gave a recommendation for those who wish to stay on Bootstrap 4 . Microsoft 在这里宣布了重大更改(从 Bootstrap 4 迁移到 5),并为希望继续使用 Bootstrap 4 的用户提供了建议。
The simplest solution: Add the MSBuild property IdentityUIFrameworkVersion
in the project ( .csproj
) file and specify Bootstrap 4:最简单的解决方案:在项目(
.csproj
)文件中添加 MSBuild 属性IdentityUIFrameworkVersion
并指定 Bootstrap 4:
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IdentityUIFrameworkVersion>Bootstrap4</IdentityUIFrameworkVersion>
</PropertyGroup>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.