File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
src/packageSourceGenerator/PackageSourceGeneratorTask Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,9 @@ private bool AddAttributesToFile(string CSharpPath) {
46
46
. ToArray ( ) ;
47
47
48
48
string attributesToAppend = string . Join ( Environment . NewLine , attributesNotInFile ) ;
49
- string replacement = "]" + Environment . NewLine + attributesToAppend + Environment . NewLine + "namespace ";
49
+ string replacement = Environment . NewLine + attributesToAppend + " \n [assembly: ";
50
50
51
- Log . LogMessage ( MessageImportance . Low , $ "Adding newline { replacement } to { CSharpPath } ") ;
52
-
53
- string modifiedContent = GetEndOfAttributesRegex ( ) . Replace ( fileContent , replacement ) ;
51
+ string modifiedContent = GetBeginningOfAttributesRegex ( ) . Replace ( fileContent , replacement , 1 ) ;
54
52
55
53
File . WriteAllText ( CSharpPath , modifiedContent ) ;
56
54
@@ -61,7 +59,7 @@ private bool AddAttributesToFile(string CSharpPath) {
61
59
return true ;
62
60
}
63
61
64
- [ GeneratedRegex ( @"\]\nnamespace " ) ]
65
- private static partial Regex GetEndOfAttributesRegex ( ) ;
62
+ [ GeneratedRegex ( @"\n\[assembly: " ) ]
63
+ private static partial Regex GetBeginningOfAttributesRegex ( ) ;
66
64
}
67
65
}
You can’t perform that action at this time.
0 commit comments