• 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.
Yaplex - Freelance developer - white logo on black background

Yaplex ® is a custom software development company located in Mississauga, Ontario. Yaplex was founded in 2013 and provides website development, mobile development, and custom .NET software development services.

Contact Information

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