@@ -6,8 +6,10 @@ internal static class Helpers
66{
77 public static void AddGeneratedFileHeader ( this IndentedStringBuilder source )
88 {
9+ var semanticVersion = GetSemanticVersion ( ) ;
10+
911 source . AppendLine ( "// <auto-generated>" ) ;
10- source . AppendLine ( "// This file was generated by Foundatio.Mediator source generators. " ) ;
12+ source . AppendLine ( $ "// Generated by Foundatio.Mediator v { semanticVersion } ") ;
1113 source . AppendLine ( "// Changes to this file may be lost when the code is regenerated." ) ;
1214 source . AppendLine ( "// </auto-generated>" ) ;
1315 source . AppendLine ( ) ;
@@ -18,12 +20,30 @@ public static void AddGeneratedFileHeader(this IndentedStringBuilder source)
1820 public static void AddGeneratedCodeAttribute ( this IndentedStringBuilder source )
1921 {
2022 var toolName = "Foundatio.Mediator" ;
21- var toolVersion = GetToolVersion ( ) ;
23+ var toolVersion = GetFullVersion ( ) ;
2224
2325 source . AppendLine ( $ "[global::System.CodeDom.Compiler.GeneratedCode(\" { toolName } \" , \" { toolVersion } \" )]") ;
2426 }
2527
26- private static string GetToolVersion ( )
28+ /// <summary>
29+ /// Gets the semantic version (e.g., "1.0.0-rc.3.9") without the commit hash suffix.
30+ /// </summary>
31+ private static string GetSemanticVersion ( )
32+ {
33+ var fullVersion = GetFullVersion ( ) ;
34+
35+ // Remove the +commitHash suffix if present
36+ var plusIndex = fullVersion . IndexOf ( '+' ) ;
37+ if ( plusIndex > 0 )
38+ return fullVersion . Substring ( 0 , plusIndex ) ;
39+
40+ return fullVersion ;
41+ }
42+
43+ /// <summary>
44+ /// Gets the full informational version including commit hash (e.g., "1.0.0-rc.3.9+abc123").
45+ /// </summary>
46+ private static string GetFullVersion ( )
2747 {
2848 var asm = typeof ( Helpers ) . Assembly ;
2949
0 commit comments