From 2f741d7268fb0ee8110fe8cab8416825aa193932 Mon Sep 17 00:00:00 2001 From: Tadej Koderman Date: Mon, 21 Oct 2024 09:32:08 +0200 Subject: [PATCH] #19: Add comment // to IgnoresAccessChecksToAttribute --- .../IgnoresAccessChecksToGenerator.Tasks.csproj | 3 ++- .../PublicizeInternals.cs | 15 +++++++++++++-- .../IgnoresAccessChecksToGenerator.Test.csproj | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/IgnoresAccessChecksToGenerator.Tasks/IgnoresAccessChecksToGenerator.Tasks.csproj b/src/IgnoresAccessChecksToGenerator.Tasks/IgnoresAccessChecksToGenerator.Tasks.csproj index 52637d8..26aec9c 100644 --- a/src/IgnoresAccessChecksToGenerator.Tasks/IgnoresAccessChecksToGenerator.Tasks.csproj +++ b/src/IgnoresAccessChecksToGenerator.Tasks/IgnoresAccessChecksToGenerator.Tasks.csproj @@ -2,8 +2,9 @@ netstandard2.0;net462 + latest IgnoresAccessChecksToGenerator - 0.7.0 + 0.7.1 true Eli Arbel https://github.com/aelij/IgnoresAccessChecksToGenerator diff --git a/src/IgnoresAccessChecksToGenerator.Tasks/PublicizeInternals.cs b/src/IgnoresAccessChecksToGenerator.Tasks/PublicizeInternals.cs index 89fdcbc..c553c96 100644 --- a/src/IgnoresAccessChecksToGenerator.Tasks/PublicizeInternals.cs +++ b/src/IgnoresAccessChecksToGenerator.Tasks/PublicizeInternals.cs @@ -75,7 +75,17 @@ private void GenerateAttributes(string path, IEnumerable assemblyNames) var attributes = string.Join(Environment.NewLine, assemblyNames.Select(a => $@"[assembly: System.Runtime.CompilerServices.IgnoresAccessChecksTo(""{a}"")]")); - var content = attributes + @" + var content = $$""" +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +{{attributes}} namespace System.Runtime.CompilerServices { @@ -86,7 +96,8 @@ public IgnoresAccessChecksToAttribute(string assemblyName) { } } -}"; +} +"""; File.WriteAllText(GeneratedCodeFilePath, content, System.Text.Encoding.UTF8); Log.LogMessageFromText("Generated IgnoresAccessChecksTo attributes", MessageImportance.Low); diff --git a/test/IgnoresAccessChecksToGenerator.Test/IgnoresAccessChecksToGenerator.Test.csproj b/test/IgnoresAccessChecksToGenerator.Test/IgnoresAccessChecksToGenerator.Test.csproj index 26ccf29..d9b1db8 100644 --- a/test/IgnoresAccessChecksToGenerator.Test/IgnoresAccessChecksToGenerator.Test.csproj +++ b/test/IgnoresAccessChecksToGenerator.Test/IgnoresAccessChecksToGenerator.Test.csproj @@ -13,7 +13,7 @@ - +