This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed
Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change 1- namespace GitHub . Info
1+ using System ;
2+ using System . Diagnostics ;
3+
4+ namespace GitHub . Info
25{
36 public static class ApplicationInfo
47 {
@@ -11,5 +14,27 @@ public static class ApplicationInfo
1114#endif
1215 public const string ApplicationSafeName = "GitHubVisualStudio" ;
1316 public const string ApplicationDescription = "GitHub Extension for Visual Studio" ;
17+
18+ /// <summary>
19+ /// Gets the version information for the host process.
20+ /// </summary>
21+ /// <returns>The version of the host process.</returns>
22+ public static FileVersionInfo GetHostVersionInfo ( )
23+ {
24+ return Process . GetCurrentProcess ( ) . MainModule . FileVersionInfo ;
25+ }
26+
27+ /// <summary>
28+ /// Gets the version of a Visual Studio package.
29+ /// </summary>
30+ /// <param name="package">
31+ /// The VS Package object. This is untyped here as this assembly does not depend on
32+ /// any VS assemblies.
33+ /// </param>
34+ /// <returns>The version of the package.</returns>
35+ public static Version GetPackageVersion ( object package )
36+ {
37+ return package . GetType ( ) . Assembly . GetName ( ) . Version ;
38+ }
1439 }
1540}
Original file line number Diff line number Diff line change 2020using Serilog ;
2121using Task = System . Threading . Tasks . Task ;
2222using EnvDTE ;
23+ using GitHub . Info ;
2324
2425namespace GitHub . VisualStudio
2526{
@@ -60,9 +61,8 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
6061
6162 void LogVersionInformation ( )
6263 {
63- // Show extension and host process version information
64- var packageVersion = GetType ( ) . Assembly . GetName ( ) . Version ;
65- var hostVersionInfo = System . Diagnostics . Process . GetCurrentProcess ( ) . MainModule . FileVersionInfo ;
64+ var packageVersion = ApplicationInfo . GetPackageVersion ( this ) ;
65+ var hostVersionInfo = ApplicationInfo . GetHostVersionInfo ( ) ;
6666 log . Information ( "Initializing GitHub Extension v{PackageVersion} in {$FileDescription} ({$ProductVersion})" ,
6767 packageVersion , hostVersionInfo . FileDescription , hostVersionInfo . ProductVersion ) ;
6868 }
You can’t perform that action at this time.
0 commit comments