I\'m deploying now a WPF c# project and want to put the clickonce version (rather than the assembly or product version) on the screen title. I used to do it in
using System;
using System.Deployment.Application;
namespace Utils
{
public class ClickOnce
{
public static Version GetPublishedVersion()
{
return ApplicationDeployment.IsNetworkDeployed
? ApplicationDeployment.CurrentDeployment.CurrentVersion
: System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
}
}
}
If you get an error about System.Deployment.Application
, then Solution > Project > References > Add Reference > Assemblies > Framework > System.Deployment.
Do not parse the assembly XML for this information; you're relying on undocumented behaviour which simply happens to work 'for now'.