File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Linq ;
3+ using System . Reflection ;
4+
5+ static class AssemblyExtensions
6+ {
7+ public static string GetVersion ( this Assembly assembly )
8+ {
9+ var informationalVersion = GetAssemblyAttribute < AssemblyInformationalVersionAttribute > ( assembly ) ;
10+ if ( informationalVersion != null )
11+ {
12+ return informationalVersion . InformationalVersion ;
13+ }
14+
15+ var version = assembly . GetName ( ) . Version ;
16+ if ( version != null )
17+ {
18+ return version . ToString ( ) ;
19+ }
20+
21+ return "unknown" ;
22+ }
23+
24+ private static TAttibute ? GetAssemblyAttribute < TAttibute > ( Assembly assembly )
25+ where TAttibute : Attribute
26+ {
27+ var attibutes = assembly . GetCustomAttributes ( typeof ( TAttibute ) ) ? . ToArray ( ) ?? Array . Empty < Attribute > ( ) ;
28+ return attibutes . Length > 0 ? attibutes [ 0 ] as TAttibute : null ;
29+ }
30+ }
Original file line number Diff line number Diff line change @@ -195,7 +195,8 @@ void ExecuteWeavers()
195195
196196 Logger . SetCurrentWeaverName ( weaver . Config . ElementName ) ;
197197 var startNew = Stopwatch . StartNew ( ) ;
198- Logger . LogInfo ( "Executing weaver" ) ;
198+ var assembly = weaver . Instance . GetType ( ) . Assembly ;
199+ Logger . LogInfo ( $ "Executing weaver { weaver . Config . ElementName } v{ assembly . GetVersion ( ) } ") ;
199200 Logger . LogDebug ( $ "Configuration source: { weaver . Config . ConfigurationSource } ") ;
200201 try
201202 {
You can’t perform that action at this time.
0 commit comments