From 7f3e064bbf419607d737d71bc063e9fe935cf931 Mon Sep 17 00:00:00 2001 From: Artur Kharin Date: Sun, 4 May 2025 16:09:10 +0300 Subject: [PATCH] Updated header to include key to exclude the file from code analysis. --- .../CodeGenerators/CsharpCodeGenerator.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ReswPlus.SourceGenerator/CodeGenerators/CsharpCodeGenerator.cs b/src/ReswPlus.SourceGenerator/CodeGenerators/CsharpCodeGenerator.cs index 7e91b9b..8c8d0e2 100644 --- a/src/ReswPlus.SourceGenerator/CodeGenerators/CsharpCodeGenerator.cs +++ b/src/ReswPlus.SourceGenerator/CodeGenerators/CsharpCodeGenerator.cs @@ -22,7 +22,9 @@ namespace ReswPlus.SourceGenerator.CodeGenerators; /// /// The generated code may look similar to the following: /// -/// // File generated automatically by ReswPlus. https://github.com/DotNetPlus/ReswPlus +/// // +/// // This code was generated by ReswPlus (https://github.com/DotNetPlus/ReswPlus). Do not edit this file directly. +/// // /// using System; /// using Windows.UI.Xaml.Markup; /// using Windows.UI.Xaml.Data; @@ -67,14 +69,18 @@ public IEnumerable GetGeneratedFiles(string? baseFilename, Strong { // Create a header comment that will be placed at the top of the generated file. var headerTrivia = TriviaList( - Comment("// File generated automatically by ReswPlus. https://github.com/DotNetPlus/ReswPlus"), + Comment(""" + // + // This code was generated by ReswPlus (https://github.com/DotNetPlus/ReswPlus). Do not edit this file directly. + // + """), CarriageReturnLineFeed ); // Build the compilation unit (the root node of a C# file) and add required using directives. var compilationUnit = CompilationUnit() - .WithLeadingTrivia(headerTrivia) - .WithUsings(List(GetUsings(info.AppType))); + .WithUsings(List(GetUsings(info.AppType))) + .WithLeadingTrivia(headerTrivia); // Create the strongly-typed static class declaration (the class that will provide resource lookup). var strongClassDecl = CreateStronglyTypedClass(info);