![clickonce](https://i-blog.csdnimg.cn/blog_migrate/fe4339baa12422af4fe17e72e2f2c7c6.png)
clickonce
I blogged a few years back about how I was disappointed that ClickOnce didn't work in FireFox, and about a year ago Saurabh (MSFT) wrote a response.
几年前,我写了一篇博客,让我对ClickOnce无法在FireFox中工作感到失望,大约一年前, Saurabh(MSFT)发表了回复。
"There have been Plugins written by the FireFox community
[e.g. http://www.softwarepunk.com/cohelper/] where they parse the application after it has been downloaded and read the deploymentProvider Url from it. They then use the undocumented Apis for invoking ClickOnce with the URL as a parameter [rundll32 dfshim.dll,ShOpenVerbApplication URL ]. I have never tried the approach above, but would believe it works.
From the ClickOnce teams perspective we would advise users against parsing the ClickOnce manifest and relying on its format for we could inadvertently break you in future manifest updates. Also since the <deploymentProvider> tag is only needed in Shell Visible installed ClickOnce applications this solution does not work for Online ClickOnce Apps.“有一些由FireFox社区编写的插件[例如http://www.softwarepunk.com/cohelper/ ],他们在下载应用程序后解析该应用程序,并从中读取DeploymentProvider Url。 然后,他们使用未记录的Apis来将URL作为参数调用[rundll32 dfshim.dll,ShOpenVerbApplication URL]。 我从未尝试过上述方法,但会相信它会起作用。 从ClickOnce团队的角度来看,我们建议用户不要分析ClickOnce清单,而依赖于它的格式,因为我们可能会在以后的清单更新中无意中破坏您。 另外,由于仅在Shell Visible已安装的ClickOnce应用程序中才需要<deploymentProvider>标记,因此该解决方案不适用于Online ClickOnce Apps。
For out next release we are looking into what we can do to provide a simple public way for the FireFox community to build plugins for ClickOnce support. Stay tuned ..."
对于下一个发行版,我们正在研究如何为FireFox社区提供一种简单的公开方式来构建用于ClickOnce支持的插件。 敬请关注 ...”
I'm still waiting for direct XBrowser support, but I can report that FFClickOnce (James Dobson's Blog) totally works, with both online and offline apps. It makes ClickOnce work in your FireFox browser. There are a few other small add-ins that were attempts at making ClickOnce work, but James' is the most elegant and best tested, by far.
我仍在等待直接的XBrowser支持,但是我可以报告FFClickOnce ( James Dobson的Blog )完全可以使用在线和离线应用程序。 它使ClickOnce在FireFox浏览器中工作。 还有其他一些小插件正在尝试使ClickOnce正常运行,但是到目前为止,James'是最优雅,测试最好的插件。
His documentation is impeccable and includes a testing section. It also scans automatically for .NET CLRs on your system and adds them to your FireFox UserAgent - a brilliant touch.
他的文档是无可挑剔的,并包括一个测试部分。 它还会自动扫描系统上的.NET CLR,并将它们添加到FireFox UserAgent中-非常出色。
Here's what you see with Firefox 2.0.0.1:
这是使用Firefox 2.0.0.1时看到的内容:
![](https://i-blog.csdnimg.cn/blog_migrate/fe5a9760f7f04a98427e9888b87c1650.png)
Here's what you see in earlier versions of Firefox:
这是在早期版本的Firefox中看到的内容:
![](https://i-blog.csdnimg.cn/blog_migrate/9c8ee4531f8a5169f01563f00ef0801d.png)
You can also turn this dialog off in the options for the Add-in and just run the ClickOnce apps directly without the interstitial.
您也可以在插件选项中关闭此对话框,而无需插页式广告即可直接运行ClickOnce应用。
I would encourage everyone who loves both FireFox and .NET to go get the FFClickOnce Extension now.
我鼓励所有同时喜欢FireFox和.NET的人立即获得FFClickOnce Extension 。
If you're working on a web application that has a ClickOnce component, I recommend that you include this extension as part of your strategy, and change your web page's flow to something like this:
如果您正在使用具有ClickOnce组件的Web应用程序,则建议您将此扩展作为策略的一部分,并将您的网页流更改为以下内容:
- User clicks the "Download Client" link... 用户点击“下载客户端”链接...
- If .NET CLR exists in the HTTP User-Agent header and it's version is greater than 2.0, issue an HTTP 302 redirect directly to your .application ClickOnce file. Done. 如果HTTP User-Agent标头中存在.NET CLR,并且其版本大于2.0,请直接发出HTTP 302重定向到您的.application ClickOnce文件。 做完了
- If the .NET CLR doesn't exist, redirect the user to a requirements page where they can download the .NET 2.0 runtime directly and then relaunch the application. Done. 如果.NET CLR不存在,请将用户重定向到要求页面,他们可以直接下载.NET 2.0运行时,然后重新启动应用程序。 做完了
- On this page, if you detect they are running FireFox, link them to FFClickOnce as a prerequisite.在此页面上,如果检测到它们正在运行FireFox,则将它们链接到FFClickOnce作为先决条件。
A flow like this will ensure that the user can click Download Client and it will Just Work. It works great for us.
这样的流程将确保用户可以单击“下载客户端”,它将正常工作。 它对我们很有用。
You could also make a new publish.htm page (the static page that is generated when you publish a ClickOnce application, and write Firefox-specific JavaScript to list the installed extensions. This solution seems yucky to me, but would catch the obscure edge-case where the user has FFClickOnce install, but has modified their User-Agent string.
您还可以创建一个新的publish.htm页面(发布ClickOnce应用程序时生成的静态页面,并编写特定于FirefoxJavaScript来列出已安装的扩展程序。此解决方案对我来说似乎很麻烦,但会遇到一些晦涩的问题-用户已安装FFClickOnce但已修改其User-Agent字符串的情况。
Thanks to James Dobson and Adam Greene for their (direct and indirect) help!
感谢James Dobson和Adam Greene(直接和间接)的帮助!
翻译自: https://www.hanselman.com/blog/a-better-way-for-clickonce-and-firefox
clickonce