If you’d like your WPF application deployed via ClickOnce to execute a custom action the first time the application is run you can use the following code:
if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
{
if (System.Deployment.Application.ApplicationDeployment.CurrentDeployment.IsFirstRun)
{
// do some initialization here
}
}
IsNetworkDeployed is a Boolean value indicating whether or not the application has been deployed via ClickOnce. IsFirstRun indicates whether this is the first time the application has been ran on the current machine. Be sure to add a reference to System.Deployment.
Enjoy!
6fe39551-2b13-4cb2-8137-3a8a61de7f0f|0|.0
.NET, WPF
wpf, clickonce