How to get the current product version in C#

How to get the current product version in C#

VersionNumber = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

[assembly: AssemblyVersion(“”)] //this the place to update the version

Fie AssemblyInfo.cs

using System.Reflection;

using System.Runtime.CompilerServices;

using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following

// set of attributes. Change these attribute values to modify the information

// associated with an assembly.

[assembly: AssemblyTitle(“Listener_1”)]

[assembly: AssemblyDescription(“”)]

[assembly: AssemblyConfiguration(“”)]

[assembly: AssemblyCompany(“Clal Insurance”)]

[assembly: AssemblyProduct(“Listener_1”)]

[assembly: AssemblyCopyright(“Copyright © Clal Insurance 2015”)]

[assembly: AssemblyTrademark(“”)]

[assembly: AssemblyCulture(“”)]

// Setting ComVisible to false makes the types in this assembly not visible

// to COM components. If you need to access a type in this assembly from

// COM, set the ComVisible attribute to true on that type.

[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM

[assembly: Guid(“3e814d74-a336-4a5e-bd6c-0162898c3045”)]

// Version information for an assembly consists of the following four values:


// Major Version

// Minor Version

// Build Number

// Revision


// You can specify all the values or you can default the Build and Revision Numbers

// by using the ‘*’ as shown below:

// [assembly: AssemblyVersion(“1.0.*”)]

[assembly: AssemblyVersion(“”)]    //////////// HERE YOU UPDATE THE VERSION

[assembly: AssemblyFileVersion(“”)]



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s