开发者

Click-Once install location from within application

I'd like to programatica开发者_StackOverflowlly determine the "publish location" (the location on the server which contains the installation) of the click-once application I'm running. I know that the appref-ms file contains this information and I could parse this file to find it but the application has no idea as to the location of the appref-ms file and I can't seem to find a way of determining this location.

Does anyone have any ideas how I can easily determine the publish location from within my application?


There's a bunch of properties on System.Deployment.Application.ApplicationDeployment.CurrentDeployment that should answer your question.

You probably want to look at .ActivationURI, or .UpdateLocation for the path you want.

(It's probably worth checking that ApplicationDeployment.IsNetworkDeployed is true first otherwise you'll get an exception.)


If your application is offline/online, you can find the appref-ms file by looking for it on the start menu.

shortcutName = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "\", publisher_name, "\", product_name, ".appref-ms");

where publisher_name and product_name are the entries on the Options dialog in the Publish property page.

Otherwise, you should be able to find it on the desktop.

RobinDotNet

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜