系统由outlook功能区添加和用VB.NET编写的Windows窗体应用程序组成。两者都使用ClickOnce部署进行部署。我需要的是能够从outlook功能区调用Windows窗体应用程序。如何在用户计算机上找到Windows窗体应用程序? Windows是否存储了可以通过应用程序名称引用的位置信息?
答案 0 :(得分:1)
如果您的Windows窗体应用程序是从URL部署的,只需在您的功能区加载项中调用它所部署的URL,它就会启动它,无论它实际安装在您的硬盘上的哪个位置。< / p>
像这样:
System.Diagnostics.Process.Start("http://mydomain.com/myapp.application")
以下是设置Click-Once部署的应用程序的快捷方式的更详细说明:http://keithelder.net/2009/04/18/how-to-run-a-clickonce-application-on-startup/
答案 1 :(得分:0)
好吧,如果您致电:
System.Diagnostics.Process.Start("http://example.com/myapp.application")
将打开浏览器以下载myapp.application。
最好将文件下载到本地文件夹,然后再运行/执行文件。
Public Sub ApplicationUpgrade()
Dim docFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Dim destFile As String = docFolder & "\myapp.application"
If System.IO.File.Exists(destFile) Then
System.IO.File.Delete(destFile)
End If
My.Computer.Network.DownloadFile("http://example.com/myapp.application", destFile)
If System.IO.File.Exists(destFile) Then
System.Diagnostics.Process.Start(destFile)
Application.Exit()
End If
End Sub
该代码会将.application文件下载到documents文件夹并自动启动文件。这将导致自动安装升级。