• Home /
  • Blog /
  • Show publish version in ClickOnce WPF or WinForms application
Version In Clickonce

Show publish version in ClickOnce WPF or WinForms application

When deploying ClickOnce application to the client, usually there is a requirement to display application version. It’s possible to hardcode application version in configuration file, or use assembly version. But when deploying ClickOnce application Visual studio can generate publish version and automatically increment revision every time you publish ClickOnce application. So it’s better to use publish version as application version. But how to display publish version in ClickOnce application if publish version will be available only after publish is done? It’s very easy with System.Deployment namespace. Below is the C# code to display publish version in ClickOnce application.

System.Deployment.Application namespace located in System.Deployment.dll which is not referenced by default, so do not forget to add reference to System.Deployment.dll
Also you always have to check IsNetworkDeployed property, because if it’s runs locally this property is false and CurrentDeployment will throw exception.

Comments

Yaplex - Freelance developer - white logo on black background

Yaplex is a custom software development company co-founded by full-stack .NET Software developer Alex Shapovalov who lives in Mississauga, ON and provides software development services in Mississauga and GTA.

Contact Information

Mississauga, ON, Canada
Phone: +1 647 328 3809
Email: alex@yaplex.com