Skip to content

Commit

Permalink
Mark source generator file as generated (#16777)
Browse files Browse the repository at this point in the history
* Mark source generator file as generated

Give the output file for the ProvideApplicationPartFactoryAttribute a ".g" suffix so that it is treated as a generated file to prevent it being flagged by source analyzers for violations the application developer cannot fix themselves.

* Add .cs suffix

Add an explicit .cs suffix.
  • Loading branch information
martincostello authored Apr 7, 2021
1 parent dd0a69a commit eabcd4d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/RazorSdk/SourceGenerators/RazorSourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void Execute(GeneratorExecutionContext context)

if (razorContext.CshtmlFiles.Count != 0)
{
context.AddSource($"{context.Compilation.AssemblyName}.UnifiedAssembly.Info", ProvideApplicationPartFactoryAttributeSourceText);
context.AddSource($"{context.Compilation.AssemblyName}.UnifiedAssembly.Info.g.cs", ProvideApplicationPartFactoryAttributeSourceText);
}

RazorGenerateForSourceTexts(razorContext.CshtmlFiles, context, projectEngine);
Expand Down

0 comments on commit eabcd4d

Please sign in to comment.