C# - Process.Start ClickOnce 应用程序?什么网址?
我刚接触 WPF 3 个月,正在尝试构建一个有趣的启动应用程序(应用程序启动器按名称键入 thingie)。
我似乎无法通过进程名称启动 ClickOnce 应用程序。
换句话说:
- Process.Start("Firefox"); // 将工作
- Process.Start("MetroTwit"); // ClickOnce 应用程序 - 不会工作
我读到您应该通过 URL 调用它?但是您在哪里可以找到已安装的 clickonce 应用程序的 URL?
理想情况下,我希望每分钟左右刷新用户系统上安装的应用程序列表(程序文件和 clickonce 和 AIR 客户端),并对类型等进行模糊搜索。
非常感谢您的帮助。
I'm 3-months new to WPF and trying to build a launchy app for fun (app launcher type thingie by name).
I can't seem to launch ClickOnce applications by Process name.
In other words:
- Process.Start("Firefox"); // will work
- Process.Start("MetroTwit"); // a ClickOnce app - will NOT work
I've read that you should be calling it by URL? But where do you find out the URL of the installed clickonce apps?
Ideally I'd want to refresh a List of apps installed on the users system (program files & clickonce & AIR clients) every minute or so and do fuzzy search on type etc.
Help greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您甚至不需要解析开始文件夹。该启动的位置位于此处:
其中publisher_name和product_name是在发布属性的“选项”对话框中设置的。
You don't even need to parse the start folders. The location of that startup is here:
Where publisher_name and product_name are the ones set in the Options dialog in the publish properties.
有两种 ClickOnce 应用程序(在发布应用程序时设置):安装在开始菜单上的应用程序和只能从 Web URL 运行的应用程序。
安装在开始菜单中的应用程序可以在开始菜单文件夹下找到(令人惊讶地),它们具有带有 APPREF-MS 扩展名的特殊类型的快捷方式。
您可以使用 Process.Start 运行 APPREF-MS 文件。
配置为仅从 Web URL 运行的应用程序,您必须从 Web URL 运行它们。
There are two kinds of ClickOnce applications (set when publishing the app) those that are installed on the start menu and those that can only be run from the web url.
Applications that are installed in the start menu can be found (surprisingly) under the start menu folder, they have special type of shortcut with the APPREF-MS extension.
You can use Process.Start to run the APPREF-MS file.
Application that are configured to only run from the web url, well, you have to run them from the web url.
恕我直言,最好的方法是:
Imho, the best way is that :
Process.Start 相当于执行 Start、Run.. 然后在其中输入一些文本。您必须输入可以使用 PATH 环境变量找到的可执行文件,或者您可以指定指向要运行的 .application 文件的 URL。例如 http://publish.url.com/publish/myapp.application。
希望有帮助!
Process.Start is equivalent to doing Start, Run.. then entering some text there. You have to enter an executable that can be found using the PATH environment variable, or you can specify the URL that points to the .application file you want to run. E.g. http://publish.url.com/publish/myapp.application.
Hope that helps!
添加到@Kieren的答案:
Process.Start("Firefox")
起作用的原因是 Firefox 将自身安装在HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox 中.exe
注册表中的键。To add to @Kieren's answer: the reason that
Process.Start("Firefox")
works is that Firefox installs itself in theHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe
key in the registry.您正在查找的 URL 是用于安装的 URL。是的,这听起来很奇怪。 ClickOnce 有点奇怪。不幸的是,ClickOnce 不会安装到 Program Files 文件夹,而是将自身隐藏在用户的 AppData 文件夹中。根据您是通过网络安装还是通过 CD/DVD 选项安装,将决定解决此问题的难易程度。祝你好运!
The URL you are looking for is the URL used for installation. Yes, it sounds strange. ClickOnce is a bit strange. Unfortunately ClickOnce does not install to the Program Files folder but instead burries itself in a users AppData Folder. Depending on whether you installed via the web or through the CD/DVD option and will determine how easy it is to resolve this. Good luck!
以下是如何启动 clickonce 应用程序并且它每次都有效。
Here is how to launch a clickonce app and it works everytime.