WPF: Show publish version in the app
---
---
WPF: Show the publish version in the app
- MainWindow.xaml
<TextBlock Name="version_lbl"/>
- Add a reference to System.Deployment.dll
- MainWindow.xaml.cs
using System.Deployment.Application;
...
public MainWindow()
{
InitializeComponent();
if (ApplicationDeployment.IsNetworkDeployed)
{
var _version = ApplicationDeployment.CurrentDeployment.CurrentVersion;
string v = $"{_version.Major}.{_version.Minor}.{_version.Build}.{_version.Revision}";
version_lbl.Text = v;
}
}
- Publish and install the app
Comments
Post a Comment