Publish Desktop Application – SmartClient

For any desktop application the first concern that comes to your mind is how you would deploy the application to your clients. We create setups and distribute the application to our clients and want our client to get any updates that we publish. But there are lots of dependency in updates. Say you want your application to get a regular updates. In such a situation, you have to distribute the setup again, so that the user installs it and get the update. You publish your application in Version, so that every time the user logs in to your site, it will get informed about the update and install it. Rather than that, you might have already tried to create a logic on your application to fetch the current version from the server and get the update in background. Yes, this would be the best way to do. Many application does this. It checks for the latest version and allows the user to get the update. Those are called Smart Client Application.

So what is required  to create such installer?

  1. You need a web folder where the current installer should be kept.
  2. The web folder must have access from the application.
  3. The installer could be downloaded and auto launched.
  4. Force the application to update itself.

So there are lots of things that you need to create to do this simple task. You need create a brand new setup project that you want to be downloaded to the client and consumed.  You also need to write a logic of when the server should be checked and how it should be downloaded. You also need to ensure that the version it downloads is correct. So there is a huge task that you need to do for this simple task.

Microsoft comes with a solution to easily address this issue and solve it. In this article, I will show how you could do this using Visual Studio without writing a single line of code.

Steps

  • Open the application in Visual Studio.
  • Create a setup if you can. Alternatively you can also use click once deployment on Web.
  • Now for Updates, Create a FTP location and an HTTP location.
  • Right Click on Project and Select Properties
  • You will see a separate Tab for publish.
  • Put your FTP location on Publishing location, so that the publish could upload the application files to the server.
  • Use Installation Location as HTTP so that the application from client site can easily download the file when required and install it.
  • You can select Publish version to ensure there is no version conflict.
  • From Options button you can configure a page which enables you to setup the application. By default the publish page will be Publish.html.

    You can configure the settings with the Publisher name, Product Name etc, which will appear in the Publish page.

  • Finally click on Publish or Publish wizard. The command will ask for Ftp UserId and Password (if any) and deploy the application on the ftp site.
  • After the application is published, you will see the launch page as below:

In the page, you can use Install Button to install in the client location.

Now if your client has the application installed in the machine, the application will automatically update itself whenever any new version is updated in the server.

This is the most basic click once deployment approach provided by Microsoft. Please note, you need to give strong name to any external assembly you produce.

To create custom Updater, you need to mimic the approach. I am also creating a self updater. I will share that once I am done with it.

Thank you for reading.

Abhishek Sur

Abhishek Sur is a Microsoft MVP since year 2011. He is an architect in the .NET platform. He has profound theoretical insight and years of hands on experience in different .NET products and languages. He leads the Microsoft User Group in Kolkata named KolkataGeeks, and regularly organizes events and seminars in various places for spreading .NET awareness. He is associated with the Microsoft Insider list on WPF and C#, and is in constant touch with product group teams. He blogs at http://www.abhisheksur.com His Book : Visual Studio 2012 and .NET 4.5 Expert Development Cookbook. Follow Abhishek at Twitter : @abhi2434

One Comment to “Publish Desktop Application – SmartClient”

  1. my sentiments and I will instantly snatch your rss feed to be updated on any upcoming content you may publish,I am really fan of your site.2

Comments are closed.