IrApp IrApp - 6 months ago 52
C# Question

how to get publish version?

I would like to show the publish version of my desktop application. I am trying to do it with this code:

_appVersion.Content = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

The problem is that I am not getting exactly the publish version I have in my project properties. Below is a screenshot of it:

enter image description here

But I am getting
. Does someone know where is the problem?


I was also having this issue and found that the version number set in AssemblyInfo.cs was interfering with the one set in Properties:

[assembly: AssemblyVersion("")]
[assembly: AssemblyFileVersion("")]

I usually comment those lines out of AssemblyInfo and replace them with

[assembly: AssemblyVersion("1.0.*")]

Check whether these values have been hard-coded into your AssemblyInfo file.

See this SO question for an interesting discussion on automatic versioning. When checking AssemblyInfo.cs, make sure your auto-increment (* - if you are using it) only targets AssemblyVersion and not AssemblyFileVersion.

When debugging the program, you could check the properties of the assembly in


Under the Details tab, check the version number. Does this match up with any of the settings you specified in VS?