How to deal with Assembly Version in .NET Core?

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

Most enterprise application soon or latter, have a requirement to trace out the version of a currently running application. This post shows few example, which demonstrates how to do this in .NET Core.

 var ver = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;

 

           

 var attrs = typeof(Startup)
.GetTypeInfo()
.Assembly.GetCustomAttributes(); 

 

var runtimeVersion = typeof(Startup)

.GetTypeInfo()

.Assembly

.GetCustomAttribute<AssemblyFileVersionAttribute>();
 

var tokens = runtimeVersion.Version.Split('.');
 

m_Version = new Version(runtimeVersion.Version)


Posted Jun 27 2017, 04:31 PM by Damir Dobric
Filed under: , ,
developers.de is a .Net Community Blog powered by daenet GmbH.