Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

One Click Applications, and detecting first launch of new version

Is there a simple way to detect the first launch of a new click-once application version? IE: I have published version 1, and then I publish 1.1. On the first launch of version 1.1 I would like to perform a one time process when it's launching.

Thanks,

Mark

like image 543
mservidio Avatar asked Aug 16 '11 18:08

mservidio


2 Answers

Check this:

 if(System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed && System.Deployment.Application.ApplicationDeployment.IsFirstRun)
 {
    //do something
 }

About IsFirstRun from msdn:

Type: System.Boolean true if this version of the application has never run on the client computer before; otherwise, false.

like image 53
Adrian Serafin Avatar answered Nov 15 '22 08:11

Adrian Serafin


The simplest solution would be to store the application version (ApplicationDeployment.CurrentDeployment.CurrentVersion) in a configuration value. If the number is different from the configuration value when you launch, then you know that it's been upgraded (or downgraded, but that should be easy enough to determine).

like image 25
Adam Robinson Avatar answered Nov 15 '22 07:11

Adam Robinson