From 1aa41d1545dca531e502e33cb1e203a580b515a5 Mon Sep 17 00:00:00 2001 From: Jacek Mokrzycki Date: Fri, 8 Apr 2022 19:45:49 +0200 Subject: [PATCH] Print various versions assigned to console's assembly --- Program.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Program.cs b/Program.cs index e5dff12..dff814e 100644 --- a/Program.cs +++ b/Program.cs @@ -1,3 +1,11 @@ -// See https://aka.ms/new-console-template for more information +using System.Diagnostics; +using System.Reflection; -Console.WriteLine("Hello, World!"); \ No newline at end of file +var executingAssembly = Assembly.GetExecutingAssembly(); +var assemblyName = executingAssembly.GetName(); +var fileVersionInfo = FileVersionInfo.GetVersionInfo(executingAssembly.Location); + +Console.WriteLine("Hello, World from version:"); +Console.WriteLine(" assembly : " + assemblyName.Version); +Console.WriteLine(" file : " + fileVersionInfo.FileVersion); +Console.WriteLine(" informational : " + fileVersionInfo.ProductVersion);