使用ClickOnce API而无需安装 [英] Using ClickOnce API without installation

查看:83
本文介绍了使用ClickOnce API而无需安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个Winforms应用程序。我使用ClickOnce发布了它。但我的要求是在表单应用程序中使用ClickOnce API,而无需在客户端安装已发布的安装程序。我发现  ApplicationDeployment.IsNetworkDeployed property
必须用于此。但每次运行应用程序时,此属性都会返回  false。  I
无法使用任何ClickOnce API。

I have a Winforms application. I have published it using ClickOnce. But my requirement is to use the ClickOnce API in the forms application without installing the published installer on the client side. I found that ApplicationDeployment.IsNetworkDeployedproperty has to be used for this. But every time I run the application, this property returns false. I am not able to use any ClickOnce APIs.


我错过了什么?如何在不安装应用程序的情况下使用ClickOnce API?

Am I missing something? What should I do to use the ClickOnce APIs without installing the application?


请分享您的想法。

Please share your thoughts.


先谢谢。

推荐答案





根据MSDN文章:IsNetworkDeployed将返回true,无论应用程序是否为在线安装或托管,无论是从网站,文件共享还是CD-ROM安装。



IsNetworkDeployed返回false的原因是ApplicationDeployment .CurrentDeployment会抛出异常。  


Hi,

According to MSDN article: IsNetworkDeployed will return true regardless of whether the application is installed or hosted online, and regardless of whether it was installed from a Web site, file share, or CD-ROM.

The reason IsNetworkDeployed would return false is when ApplicationDeployment.CurrentDeployment throws an exception.  

try
 {
      ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
 }
 catch (Exception e)
 {
      MessageBox.Show("Exception: " + e.Message + "\n" + e.StackTrace);
 }

以下代码会捕获异常,例如"应用程序标识未设置"。

Below code will catch a exception, say "Application identity is not set".

此问题的原因可能是因为您 或应用程序可能无法应用
网络位置安装机器。请检查安装Uri是否可用,并检查您是否有权访问您托管clickOnce应用程序的位置。

The cause of this problem may be because youdeployed on network location or applied network location might not be available from application installed machine. Please check the installtion Uri is available ,and check you have permission to access the lication where you host your clickOnce App.

希望这会有所帮助。

最诚挚的问候,

Bob


这篇关于使用ClickOnce API而无需安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆