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

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.

Get latest updates directly into your inbox


Yaplex logo white text

Yaplex is an IT Consulting and .NET development company co-founded by .NET Developer Alex Shapovalov who lives in Mississauga and provides software development services in Toronto, Mississauga, and GTA.

Contact Information

Toronto, Canada
Phone: +1 647 328 3809