Reputation: 27
I use this code for get application version
private string CurrentVersion
{
get
{
return ApplicationDeployment.IsNetworkDeployed
? ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString()
: Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}
But in debug mode and when I publish and install application I get 1.0.0.0. How can I fix this problem?
Upvotes: 2
Views: 1868
Reputation: 34244
In this line of code you are actually trying to obtain an assembly version.
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
You need to set the assembly version in Properties -> Application -> Assembly Information
.
Upvotes: 2