Getting the Version of my C# app?

The info you are looking for is in AssemblyInfo.cs.

To access the info written in there at runtime you can use the System.Reflection.Assembly.

Use System.Reflection.Assembly.GetExecutingAssembly() to get the assembly (that this line of code is in) or use System.Reflection.Assembly.GetEntryAssembly() to get the assembly your project started with (most likely this is your app).

In multi-project solutions this is something to keep in mind!

string version = Assembly.GetExecutingAssembly().GetName().Version.ToString()
// returns 1.0.0.0

Corresponding AssemblyInfo.cs:

AssemblyInfo.cs

Corresponding EXE-properties:

EXE properties

This may be important when working with InstallShield (see comments) !


System.Reflection.Assembly executingAssembly = System.Reflection.Assembly.GetExecutingAssembly();
var fieVersionInfo = FileVersionInfo.GetVersionInfo(executingAssembly .Location);
var version = fieVersionInfo.FileVersion;