Skip to content

Commit 21a64d7

Browse files
Copilotjaviercn
andcommitted
Fix syntax error in test method
Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
1 parent f44a784 commit 21a64d7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/Microsoft.NET.Sdk.StaticWebAssets.Tests/ScopedCssIntegrationTests.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,14 @@ public void Build_GeneratesUrlEncodedLinkHeaderForNonAsciiProjectName()
636636

637637
// Add assembly name property to ensure consistent naming
638638
var libProjectContent = File.ReadAllText(newLibProjectFile);
639-
libProjectContent = libProjectContent.Replace("</PropertyGroup>",
640-
" <AssemblyName>项目</AssemblyName>\n <PackageId>项目</PackageId>\n </PropertyGroup>", 1);
639+
// Find the first PropertyGroup closing tag and replace it
640+
var targetPattern = "</PropertyGroup>";
641+
var replacement = " <AssemblyName>项目</AssemblyName>\n <PackageId>项目</PackageId>\n </PropertyGroup>";
642+
var index = libProjectContent.IndexOf(targetPattern);
643+
if (index >= 0)
644+
{
645+
libProjectContent = libProjectContent.Substring(0, index) + replacement + libProjectContent.Substring(index + targetPattern.Length);
646+
}
641647
File.WriteAllText(newLibProjectFile, libProjectContent);
642648

643649
// Update the main project to reference the renamed library

0 commit comments

Comments
 (0)