A short thread on our local .Net UG mailing list has prompted me to document why I don’t use ClickOnce and how I do No-Touch deployment of internal applications . I thought I had blogged about this in the past but I can’t find anything totally relevant. So, here goes.
ClickOnce v No-Touch
As I see it, the benefits of ClickOnce over No-Touch are as follows:
- You can give the user the choice of upgrading or not.
That’s it. And really, you can do this with No-Touch also but for internal applications where you have a fast local LAN and complete control of the environment I think ClickOnce just makes this way more complex than it needs to be. Plus, creating ClickOnce deployments is not an easy thing to do outside of Visual Studio so if you want to automate this you need to learn MAGE.
How I do No-Touch Deployment
Here’s a condensed step by step that may help someone else.
- Create a virtual directory for your deployment – probably in IIS but other web servers are supposed to work.
- Make sure the new VDir is configured as an Application in IIS.
- If you are using IIS 5 (Win 2k) then you probably need to allow .config files to be served. To do this you need to have a web.config file in the VDir (or it’s parent) that contains this:
<
system.web>
<httpHandlers>
<remove verb="*" path="*.config" />
<add verb="*" path="web.config" type="System.Web.HttpForbiddenHandler" />
</httpHandlers>
</system.web>
This tells IIS to allow any .config file EXCEPT web.config to be served.
-
Copy your client files in the root of the virtual folder – including all DLL’s, EXE’s and EXE.CONFIG files.
-
If your application loads DLL or other files dynamically at runtime then use the VDir url to point to those files.
-
Configure a Security Policy Code Group for the URL – giving full trust or any reduced level you can get away with.
-
Export the Security Policy to an MSI.
-
Provide a web page or something for users that includes a link to the client EXE in the new virtual, plus a link to the .Net runtime installer and the new security policy MSI.
Using IE the users can launch the application once they have installed the framework and configured permissions. Alternatively you can create a launcher application.
Now you can simply replace the contents of the VDir with new versions and the users will automatically get the updates next time they execute the app. If you want to have multiple applications or multiple versions of the same application available at the same time, then simply create a new VDir for each app or version.
If you have web services or remoting components that are tied to a particular version of the application then these can live in a sub-directory of the VDir. For Remoting there are a few extra tricks involved which I have document elsewhere if anyone wants to know.
If you have a database backing the application then you may run into problems supporting multiple concurrent versions of an application accessing the database. This is probably more trouble than it is worth so I tend to force updates to all users rather than supporting multiple versions. So you really need to ask users to shutdown while you upgrade the database and VDir deployment. I don’t see how ClickOnce would make this any easier though.
Enjoy