Created
July 21, 2023 11:04
-
-
Save solrevdev/8216646bd547aff991fb693b8f1d98cc to your computer and use it in GitHub Desktop.
How to get the running .NET version and also the current Product version via <Version> element in csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Reflection; | |
var dotnetVersion = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription; | |
Console.WriteLine($"๐ .NET Version: {dotnetVersion}"); | |
var productVersion = Assembly.GetEntryAssembly().GetCustomAttribute<System.Reflection.AssemblyInformationalVersionAttribute>().InformationalVersion; | |
Console.WriteLine($"๐ Product Version : {productVersion}"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment