My Experiences Setting Up ClickOnce
For 6 months now I've been waiting for the opportunity to start deploying some of our internal applications via ClickOnce.
For those who don't know, ClickOnce is a new feature added to the 2.0 framework and VS2005. If you publish your application via clickonce, then you only need to provide a URL to your users - they goto that url, click the install button, and the application gets installed. From that point on, if you publish a newer version of your application, your users, the application automatically updates itself.
So here's what I've learned when trying to deploy a ClickOnce application to a server when I can't select the 'Publish' option in Visual Studio to publish directly to that server.
- Set up a virtual directory on the remote server.
- Give it anonymous access (I'd like to know if it can be limited to NTLM, but I haven't tested it yet).
- Don't bother to install the 2.0 .net framework. I did and it made no difference :)
- Don't bother to register ASP.net 2.0. I did (using aspnet_regiis.exe) and it made no difference :)
- For the virtual directory, go into the properties, select the HTTP Headers tab, click the File Types button, and register a new type. Put '.application' as the associated extension, and 'application/x-ms-application' as the Content Type. This one, as I discovered last, is the key.
- For niceness, add 'publish.htm' as a default document for your virtual directory.
Having done this, I told my test app to deploy to localhost. The files deployed just need to be copied to the remote server. So once I'd done this, I navigated to http://mydeploymentserver/ClickOnce/TestApp (where ClickOnce was the virtual directory I created, and TestApp was the sub folder I told it to make), and up came the install page.
If step 5 from above is missed, when you then click the install button all you get is a heap of XML streamed to the browser. By registering the mime type, ClickOnce kicks in when you click the install button, and it all works like magic.