[Identity] Add warnings when using Bootstrap3 and errors when using an unknown framework version (#12988)

* [Identity] Add warnings when using Bootstrap3 and errors when using an unknown framework version
This commit is contained in:
Javier Calvarro Nelson 2019-08-09 15:56:09 +02:00 committed by GitHub
parent e4b4476b37
commit 5c71742e4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 0 deletions

View File

@ -30,6 +30,8 @@
<Content Remove="@(Content)" />
<Content Include="wwwroot\**\*" Pack="true" />
<None Include="build\*" Pack="true" PackagePath="build\" />
<None Include="buildMultiTargeting\*" Pack="true" PackagePath="buildMultiTargeting\" />
<None Include="buildTransitive\*" Pack="true" PackagePath="buildTransitive\" />
<None Include="THIRD-PARTY-NOTICES.txt" Pack="true" PackagePath="/THIRD-PARTY-NOTICES.txt" />
</ItemGroup>

View File

@ -0,0 +1,34 @@
<Project>
<Target Name="ValidateIdentityUIFrameworkVersion" BeforeTargets="Build">
<PropertyGroup>
<_IdentityUIBootstrap3WarningMessage>'Bootstrap3' is obsolete. It is recommended that the application is updated to use a supported Bootstrap version by removing the 'IdentityUIFrameworkVersion' property from '$(MSBuildProjectFile)' or setting 'IdentityUIFrameworkVersion' explicitly to 'Bootstrap4'.
</_IdentityUIBootstrap3WarningMessage>
<_IdentityUIUnknownVersionErrorMessage>The 'IdentityUIFrameworkVersion' '$(IdentityUIFrameworkVersion)' in '$(MSBuildProjectFile)' is not valid. Valid versions are 'Bootstrap3' and 'Bootstrap4'.
</_IdentityUIUnknownVersionErrorMessage>
</PropertyGroup>
<ItemGroup>
<_IdentityUIActiveWarnings Include="IdentityUI001;IdentityUI002" Exclude="$(NoWarn)" />
</ItemGroup>
<Warning Code="IdentityUI001"
Text="$(_IdentityUIBootstrap3WarningMessage)"
File="@(MSBuildThisProjectFile)"
Condition="'$(IdentityUIFrameworkVersion)' == 'Bootstrap3' and '%(_IdentityUIActiveWarnings.Identity)' == 'IdentityUI001' and '$(WarningsAsErrors)' != 'true'" />
<Error Code="IdentityUI001"
Text="$(_IdentityUIBootstrap3WarningMessage)"
File="@(MSBuildThisProjectFile)"
Condition="'$(IdentityUIFrameworkVersion)' == 'Bootstrap3' and '%(_IdentityUIActiveWarnings.Identity)' == 'IdentityUI001' and '$(WarningsAsErrors)' == 'true'" />
<Error
Code="IdentityUI002"
Text="$(_IdentityUIUnknownVersionErrorMessage)"
File="@(MSBuildThisProjectFile)"
Condition="'$(IdentityUIFrameworkVersion)' != 'Bootstrap3' and $(IdentityUIFrameworkVersion) != 'Bootstrap4' and '%(_IdentityUIActiveWarnings.Identity)' == 'IdentityUI002'" />
</Target>
</Project>

View File

@ -0,0 +1,5 @@
<Project>
<Import Project="..\build\Microsoft.AspnetCore.Identity.UI.targets" />
</Project>

View File

@ -0,0 +1,5 @@
<Project>
<Import Project="..\buildMultiTargeting\Microsoft.AspnetCore.Identity.UI.targets" />
</Project>