Analytics


Google

Friday, August 1, 2008

.NET Application Updater Component

For those who are writing Java application, you can use Java WebStart to create rich client which allows automatic update of the application. The equivalent of this for .Net Framework is called .NET Application Updater Component.

Details of the component can be found here.

Prior to .Net all deployment needs to update registry, the following articles talk about simplifying the deployment. In fact, you can use both concepts together.

I tried the Application Updater and found it to be very easy with one caution:

Don't use DownloadOnDetection. I found that when you do that it keeps detecting and downloading the code even if I did not change the application version.

I used Method 3 for the deployment and it works well with our users. Here is a snippet describing it.

The final approach used to perform the application update was inspired by the side-by-side assembly model of the .NET Framework. Instead of trying to update the application itself, create a new upto-date version of the application next to the existing version. The new version can be created by merging the existing application directory with the downloaded update. When the new version is complete, the user will automatically use that version the next time they launch the application. The original copy of the application can then be removed. This tricky part is figuring out which version to launch at any given time. To do that, a program named Appstart is introduced. Appstart is the entry point into your application. With this model, your application directory will look something like this:

Program Files

MyApp

Appstart.exe

Appstart.config

V1 Folder

MyApp.exe

V1.1 Folder

MyApp.exe

To run your application, you always run Appstart.exe. If you want a shortcut on the desktop, the shortcut should point at Appstart, not at the application directly (Note that you can rename AppStart.exe to be whatever you want, ex. YourApp.exe). Appstart.exe is a very simple program that reads the Appstart.config file and launches the specified application. A valid Appstart.config file looks like the following:

<Config>

<AppFolderName>V1 Folder</AppFolderName>

<AppExeName>MyApp.exe</AppExeName>

<AppLaunchMode>appdomain</AppLaunchMode>

</Config>

  • Whenever the user starts using the program, it will go to the webserver to see if there is a new version of my application. If there is, it will download and then he will start using the new version.
  • My application contains multiple assemblies (.dll files). If the user deletes them, the updater component will automatically get a new copy from the webserver.
I found the easiest way to deploy it is to first go to the users workstation to set it up. This is because I want to make sure the user launches the application from the launcher and not the assembly (.exe file) directly so that the updater will work. The application needs to be launched through the AppStart.exe. (Just as you use JavaWebStart to start your Java Web Start applications).

4 comments:

Anonymous said...

Hi, I've used .net application updater. I've setup webserver on my local machine. Whenever application tries to check for the updates it always throwing an error "The remote server returned an error: (405) Method Not allowed" Any idea why I'm getting this error. I'm using IIS7.

Thanks
JP

Strovek said...

JP,

You might want to see which version of Framework you are using. I tested it with Framework 1.1. In the later version of .Net, there may have new ways of doing the deployment.

Monicuta said...

JP,

I had 405 too in IIS 7 untill I configured WebDAV in IIS which adds support for the HTTP-DAV protocol. Now ever since I did that I'm getting 401 - Unauthorized back...:( still haven't find a way to get pass this one yet.

Strovek said...

Monicuta/JP,

IIS 7 has a different kind of security. Try looking at the folder security and also the application pool configuration.