File tree Expand file tree Collapse file tree 4 files changed +34
-1
lines changed
ThisAssembly.AssemblyInfo Expand file tree Collapse file tree 4 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ public class AssemblyInfoGenerator : IIncrementalGenerator
2121 nameof ( AssemblyCompanyAttribute ) ,
2222 nameof ( AssemblyCopyrightAttribute ) ,
2323 nameof ( AssemblyTitleAttribute ) ,
24+ nameof ( AssemblyDescriptionAttribute ) ,
2425 nameof ( AssemblyProductAttribute ) ,
2526 nameof ( AssemblyVersionAttribute ) ,
2627 nameof ( AssemblyInformationalVersionAttribute ) ,
Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ public static class Extensions
4+ {
5+ public static string ReplaceLineEndings ( this string input ) => ReplaceLineEndings ( input , Environment . NewLine ) ;
6+
7+ public static string ReplaceLineEndings ( this string input , string replacementText )
8+ {
9+ #if NET6_0_OR_GREATER
10+ return input . ReplaceLineEndings ( replacementText ) ;
11+ #else
12+ // First normalize to LF
13+ var lineFeedInput = input
14+ . Replace ( "\r \n " , "\n " )
15+ . Replace ( "\r " , "\n " )
16+ . Replace ( "\f " , "\n " )
17+ . Replace ( "\x0085 " , "\n " )
18+ . Replace ( "\x2028 " , "\n " )
19+ . Replace ( "\x2029 " , "\n " ) ;
20+
21+ // Then normalize to the replacement text
22+ return lineFeedInput . Replace ( "\n " , replacementText ) ;
23+ #endif
24+ }
25+ }
Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ public void CanReadResourceFile()
1717 public void CanUseInfo ( )
1818 => Assert . Equal ( "ThisAssembly.Tests" , ThisAssembly . Info . Title ) ;
1919
20+ [ Fact ]
21+ public void CanUseInfoDescription ( )
22+ => Assert . Equal ( @"A Description
23+ with a newline" . ReplaceLineEndings ( ) , ThisAssembly . Info . Description . ReplaceLineEndings ( ) ) ;
24+
2025 [ Fact ]
2126 public void CanUseConstants ( )
2227 => Assert . Equal ( "Baz" , ThisAssembly . Constants . Foo . Bar ) ;
Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <IsPackable >false</IsPackable >
5- <TargetFramework >net6.0</TargetFramework >
5+ <TargetFramework >net7.0</TargetFramework >
6+ <Description >A Description
7+ with a newline</Description >
68 <TargetFramework Condition =" '$(BuildingInsideVisualStudio)' == 'true'" >net472</TargetFramework >
79 <RootNamespace >ThisAssemblyTests</RootNamespace >
810 <CopyLocalLockFileAssemblies >true</CopyLocalLockFileAssemblies >
You can’t perform that action at this time.
0 commit comments