views:

63

answers:

1

So I have developed my application in C#. I am ready to deploy it. I want to make it so that users always launch it from my website (so that they always get updates, no install, etc.).

Is ClickOnce the proper way to do this?

I tried deploying ClickOnce to my server and a few things jump out at me:

1) The user is given the option to run a setup or launch the .application file - what's the difference? Can't it detect this on it's own?

2) When I try to "launch" the .application it asks to download it to my computer. Anyway to just launch the file straight from the browser?

3) After I download and run the .application file I get an error with the following message: "Deployment and application do not have matching security zones."

+4  A: 

Yes, ClickOnce suits your needs perfectly.

  1. The setup.exe, or "bootstrapper" as it's called, is used to install prerequisites such as the .NET Framework and Microsoft Installer, since it is the .NET framework that contains the ClickOnce runtime, which is needed to install your application. The bootstrapper needs to be used only once and only on computers that don't have those prerequisites, after that only the .application file, called the "deployment manifest", is used for updates. When you publish using ClickOnce, a Publish.htm file is created, which contains some JavaScript code that detects if the user has the prerequisites installed. If the user doesn't, it presents a button that links to setup.exe, otherwise it present a button which links directly to the .application file. You can use that page (or create one based on it) to give the shortest possible installation experience for your users.

  2. Either the .NET Framework is not installed on the client's computer (in this case, use the bootstrapper), or your web server is not configured properly, and so does not associate the .application extension with the MIME type of application/x-ms-application. Create that association to solve the issue. I also recommend adding some http headers to disable the cache on the deployment manifest, otherwise the user's browser can cache it and it could lead to the user missing updates.

  3. You cannot download and run the deployment manifest file locally for a ClickOnce installation that was published to a web location, since ClickOnce gives a higher trust level to local installation (such as from the local computer or a network share), but the application manifest points to an installation source on the web, which has a lower trust level, and thus fails. Once you solve issue 2, this issue will also be resolved.

Allon Guralnek
Excellent answers. A few more questions:1) Should I link users to the setup file, or the .application file?2) It launches properly in IE but not firefox. In Firefox it asks to download the file. Is this a MIME type config issue? Any tips on that (Linux/Apache server)
whydna
@whydna: Thanks! 1. I edited the answer to talk about `Publish.htm`, 2. Installing a ClickOnce application from Firefox requires a plug-in, such as the [one provided by Microsoft](http://windowsclient.net/wpf/wpf35/wpf-deploying-clickonce-ie-firefox.aspx) with the .NET Framework 3.5 **SP1**, or a 3rd party plug-in, such as [FFClickOnce](https://addons.mozilla.org/en-US/firefox/addon/1608/).
Allon Guralnek
So what are my options with Firefox/Chrome/any other browser out there?Also, it doesnt seem to detect whether the user has ran the setup as you mentioned in your post. It simply presents 2 links and asks the user to figure it out. Eg: http://www.kirupafx.com/clickonce/publish.htm
whydna
Basically, the bootstrapper is used for all browsers other than IE, since it knows how to call ClickOnce properly. This is reflected in the `Publish.htm` file as well - if the browser is not IE or Firefox, it will link directly to the bootstrapper. You may want to change it so that it will link to the bootstrapper even if it detects Firefox, since the plug-in is not installed on most people's machines. As for your `Publish.htm`, it's odd, since I only see one button with IE8. Again, you might not even want to rely on `Publish.htm` and always link to the bootstrapper.
Allon Guralnek
If the user doesn't have the prerequisites installed, the bootstrapper will automatically download and install them (that's what it's for). If they're already installed, it will hand off control to the ClickOnce installer. Keep in mind that installing the prerequisites requires administrator privileges (and it will prompt for them if UAC is on) while installing ClickOnce applications does not.
Allon Guralnek
Thanks, gotcha. It just seems a bit annoying to have to download this setup file when it is supposed to just launch from the web browser.
whydna
Allon Guralnek