minor Blazor Identity fixes (#2998)
* minor Blazor Identity fixes (#2997) * updated ProjectModifierHelper.ModifyDocumentText * use ignore case extension for the 'Contains' check. * more small fixes
This commit is contained in:
Родитель
17eb9f0891
Коммит
0eeba65d51
|
@ -62,7 +62,7 @@
|
|||
<PropertyGroup>
|
||||
<VersionPrefix>9.0.0</VersionPrefix>
|
||||
<PreReleaseVersionLabel>rc</PreReleaseVersionLabel>
|
||||
<PreReleaseVersionIteration>1</PreReleaseVersionIteration>
|
||||
<PreReleaseVersionIteration>2</PreReleaseVersionIteration>
|
||||
<IncludeSourceRevisionInInformationalVersion>False</IncludeSourceRevisionInInformationalVersion>
|
||||
<IsServicingBuild Condition="'$(PreReleaseVersionLabel)' == 'servicing'">true</IsServicingBuild>
|
||||
<!--
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
set VERSION=9.0.0-dev
|
||||
set DEFAULT_NUPKG_PATH=%userprofile%/.nuget/packages
|
||||
set DEFAULT_NUPKG_PATH=C:\Nuget
|
||||
set SRC_DIR=%cd%
|
||||
set NUPKG=artifacts\packages\Debug\Shipping\
|
||||
call taskkill /f /im dotnet.exe
|
||||
|
|
|
@ -357,13 +357,17 @@ namespace Microsoft.VisualStudio.Web.CodeGenerators.Mvc.Blazor
|
|||
if (file.FileName.Equals("Routes.razor", StringComparison.OrdinalIgnoreCase) &&
|
||||
FileSystem.FileExists(fileDoc.Name))
|
||||
{
|
||||
var usingStatement = $"@using {blazorIdentityModel.BlazorIdentityNamespace}.Shared";
|
||||
var fileText = FileSystem.ReadAllText(fileDoc.Name);
|
||||
fileText = $"@using {blazorIdentityModel.BlazorIdentityNamespace}.Shared" + Environment.NewLine + fileText;
|
||||
if (!fileText.Contains(usingStatement, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
fileText = usingStatement + Environment.NewLine + fileText;
|
||||
FileSystem.WriteAllText(fileDoc.Name, fileText.ToString());
|
||||
Logger.LogMessage($"Modified {fileDoc.Name}.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal async Task ModifyProgramCsAsync(CodeFile programCsFile, BlazorIdentityModel blazorIdentityModel)
|
||||
{
|
||||
|
|
|
@ -111,7 +111,8 @@
|
|||
" <RedirectToLogin />",
|
||||
" </NotAuthorized>",
|
||||
" </AuthorizeRouteView>"
|
||||
]
|
||||
],
|
||||
"CheckBlock": "<NotAuthorized>"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -124,6 +125,7 @@
|
|||
" background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E\");",
|
||||
"}"
|
||||
],
|
||||
"CheckBlock": "bi-lock-nav-menu",
|
||||
"MultiLineBlock": [
|
||||
".bi-list-nested-nav-menu {",
|
||||
" background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E\");",
|
||||
|
@ -151,6 +153,7 @@
|
|||
"FileName" : "NavMenu.razor",
|
||||
"Replacements": [
|
||||
{
|
||||
"CheckBlock": "@implements IDisposable",
|
||||
"ReplaceSnippet": [
|
||||
"<div class=\"top-row ps-3 navbar navbar-dark\">"
|
||||
],
|
||||
|
@ -161,6 +164,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"CheckBlock": "<AuthorizeView>",
|
||||
"ReplaceSnippet": [
|
||||
"<span class=\"bi bi-list-nested-nav-menu\" aria-hidden=\"true\"></span> Weather",
|
||||
" </NavLink>",
|
||||
|
@ -203,6 +207,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"CheckBlock": "OnInitialized()",
|
||||
"MultiLineBlock": [
|
||||
"@code {",
|
||||
" private string? currentUrl;",
|
||||
|
@ -238,7 +243,8 @@
|
|||
"MultiLineBlock": [
|
||||
"@using Microsoft.AspNetCore.Components.Forms",
|
||||
"@using Microsoft.AspNetCore.Components.Authorization"
|
||||
]
|
||||
],
|
||||
"CheckBlock": "Microsoft.AspNetCore.Components.Authorization"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -553,7 +553,8 @@ namespace Microsoft.DotNet.Scaffolding.Shared.Project
|
|||
if (change.ReplaceSnippet != null)
|
||||
{
|
||||
var replaceSnippet = string.Join(Environment.NewLine, change.ReplaceSnippet);
|
||||
if (sourceFileString.Contains(replaceSnippet))
|
||||
if (!sourceFileString.ContainsIgnoreCase(change.CheckBlock) &&
|
||||
sourceFileString.ContainsIgnoreCase(replaceSnippet))
|
||||
{
|
||||
sourceFileString = sourceFileString.Replace(replaceSnippet, change.Block);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче