System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
will get you the assembly version that exist in the AssemblyInfo.cs file, to get the publish version that you set in the publish dialog, you should use
System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion
But notice that you have to add reference to System.Deployment, and it will work only after you publish your application by right click on the project file and click publish, everytime you publish, it will increment the Revision.
If you tried to call the above line in debug mode it will not work and will throw an exception, so you can use the following code:
try
{
return System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion;
}
catch(Exception ex)
{
return Assembly.GetExecutingAssembly().GetName().Version;
}