File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
samples/TagHelperPack.Sample/Services Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,17 @@ private string GetAspNetCoreVersion()
107107 var aspNetCoreAssembly = AppDomain . CurrentDomain . GetAssemblies ( )
108108 . FirstOrDefault ( a => string . Equals ( a . GetName ( ) . Name , "Microsoft.AspNetCore" , StringComparison . OrdinalIgnoreCase ) ) ;
109109
110+ // Get AssemblyInformationalVersion
111+ var assemblyInformationalVersion = aspNetCoreAssembly . GetCustomAttribute < AssemblyInformationalVersionAttribute > ( ) ? . InformationalVersion ;
112+ if ( assemblyInformationalVersion != null )
113+ {
114+ var indexOfPlus = assemblyInformationalVersion . IndexOf ( '+' ) ;
115+ return indexOfPlus >= 0
116+ ? assemblyInformationalVersion . Substring ( 0 , indexOfPlus )
117+ : assemblyInformationalVersion ;
118+ }
119+
120+ // Try shared framework directory name
110121 try
111122 {
112123 var aspNetCorePath = aspNetCoreAssembly . Location ;
@@ -116,7 +127,7 @@ private string GetAspNetCoreVersion()
116127 }
117128 }
118129 catch ( Exception ) { }
119-
130+
120131 // Just use the version of the Microsoft.AspNetCore assembly
121132 return aspNetCoreAssembly . GetName ( ) . Version . ToString ( ) ;
122133 }
You can’t perform that action at this time.
0 commit comments