File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed
src/Umbraco.AuthorizedServices Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change 1- using System . Diagnostics ;
1+ using System . Reflection ;
2+ using Umbraco . Cms . Core . Semver ;
3+ using Umbraco . Extensions ;
24
35namespace Umbraco . AuthorizedServices ;
46
@@ -10,7 +12,28 @@ public static class Constants
1012
1113 public const string Separator = "-" ;
1214
13- public static readonly string InformationalVersion = FileVersionInfo . GetVersionInfo ( typeof ( Constants ) . Assembly . Location ) . ProductVersion ! ;
15+ public static readonly string InformationalVersion = GetInformationalVersion ( ) ;
16+
17+ private static string GetInformationalVersion ( )
18+ {
19+ Assembly assembly = typeof ( Constants ) . Assembly ;
20+ AssemblyInformationalVersionAttribute ? assemblyInformationalVersionAttribute = assembly . GetCustomAttribute < AssemblyInformationalVersionAttribute > ( ) ;
21+ if ( assemblyInformationalVersionAttribute is not null &&
22+ SemVersion . TryParse ( assemblyInformationalVersionAttribute . InformationalVersion , out SemVersion ? semVersion ) )
23+ {
24+ return semVersion ! . ToSemanticStringWithoutBuild ( ) ;
25+ }
26+ else
27+ {
28+ AssemblyName assemblyName = assembly . GetName ( ) ;
29+ if ( assemblyName . Version is not null )
30+ {
31+ return assemblyName . Version . ToString ( 3 ) ;
32+ }
33+ }
34+
35+ return string . Empty ;
36+ }
1437
1538 public static class Trees
1639 {
You can’t perform that action at this time.
0 commit comments