File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
test/Microsoft.NET.Sdk.StaticWebAssets.Tests Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -636,8 +636,14 @@ public void Build_GeneratesUrlEncodedLinkHeaderForNonAsciiProjectName()
636
636
637
637
// Add assembly name property to ensure consistent naming
638
638
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
+ }
641
647
File . WriteAllText ( newLibProjectFile , libProjectContent ) ;
642
648
643
649
// Update the main project to reference the renamed library
You can’t perform that action at this time.
0 commit comments