开发者

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 开发者_StackOverflowtime process when it's launching.

Thanks,

Mark


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.


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜