diff --git a/src/ThisAssembly.AssemblyInfo/AssemblyInfoGenerator.cs b/src/ThisAssembly.AssemblyInfo/AssemblyInfoGenerator.cs index 310ceeb7..debda663 100644 --- a/src/ThisAssembly.AssemblyInfo/AssemblyInfoGenerator.cs +++ b/src/ThisAssembly.AssemblyInfo/AssemblyInfoGenerator.cs @@ -21,6 +21,7 @@ public class AssemblyInfoGenerator : IIncrementalGenerator nameof(AssemblyCompanyAttribute), nameof(AssemblyCopyrightAttribute), nameof(AssemblyTitleAttribute), + nameof(AssemblyDescriptionAttribute), nameof(AssemblyProductAttribute), nameof(AssemblyVersionAttribute), nameof(AssemblyInformationalVersionAttribute), diff --git a/src/ThisAssembly.Tests/Extensions.cs b/src/ThisAssembly.Tests/Extensions.cs new file mode 100644 index 00000000..6385bccc --- /dev/null +++ b/src/ThisAssembly.Tests/Extensions.cs @@ -0,0 +1,25 @@ +using System; + +public static class Extensions +{ + public static string ReplaceLineEndings(this string input) => ReplaceLineEndings(input, Environment.NewLine); + + public static string ReplaceLineEndings(this string input, string replacementText) + { +#if NET6_0_OR_GREATER + return input.ReplaceLineEndings(replacementText); +#else + // First normalize to LF + var lineFeedInput = input + .Replace("\r\n", "\n") + .Replace("\r", "\n") + .Replace("\f", "\n") + .Replace("\x0085", "\n") + .Replace("\x2028", "\n") + .Replace("\x2029", "\n"); + + // Then normalize to the replacement text + return lineFeedInput.Replace("\n", replacementText); +#endif + } +} diff --git a/src/ThisAssembly.Tests/Tests.cs b/src/ThisAssembly.Tests/Tests.cs index ae8e7002..fd7ff9a4 100644 --- a/src/ThisAssembly.Tests/Tests.cs +++ b/src/ThisAssembly.Tests/Tests.cs @@ -17,6 +17,11 @@ public void CanReadResourceFile() public void CanUseInfo() => Assert.Equal("ThisAssembly.Tests", ThisAssembly.Info.Title); + [Fact] + public void CanUseInfoDescription() + => Assert.Equal(@"A Description +with a newline".ReplaceLineEndings(), ThisAssembly.Info.Description.ReplaceLineEndings()); + [Fact] public void CanUseConstants() => Assert.Equal("Baz", ThisAssembly.Constants.Foo.Bar); diff --git a/src/ThisAssembly.Tests/ThisAssembly.Tests.csproj b/src/ThisAssembly.Tests/ThisAssembly.Tests.csproj index 6337bf10..e1c47364 100644 --- a/src/ThisAssembly.Tests/ThisAssembly.Tests.csproj +++ b/src/ThisAssembly.Tests/ThisAssembly.Tests.csproj @@ -2,7 +2,9 @@ false - net6.0 + net7.0 + A Description +with a newline net472 ThisAssemblyTests true