C# Deploying the application – clickonce from web only

cclickoncedeployment

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."

Best Answer

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.