ClickOnce Deployment – Deploying multiple versions of the same application


According to Wikipedia, ClickOnce is a Microsoft technology that enables the user base to install and run a Windows Application by clicking a link in a web page. ClickOnce is a component of Microsoft .NET Framework 2.0 and later and it supports deploying applications made with Windows Forms or Windows Presentation Foundation.

ClickOnce attempts to bring the ease of deployment similar to web applications to the Windows user base. ClickOnce aims to solve three common problems with conventional methods of deploying an application:

  1. The sometimes difficulty of updating a deployed application.
  2. The impact of an application on a user’s computer system.
  3. The need for administrator permission in order to install or update the application.

A ClickOnce deployed application has low impact and it is installed on a per-user basis, as opposed to a per-machine basis. There are no Admin rights required to install a ClickOnce deployed application. Each ClickOnce application is deployed to a unique folder and is isolated from any other ClickOnce applications for the same user, on the same machine. This means that ClickOnce applications are independent and are not able to break each other.

Having said all of that, there are times when you need to deploy two different versions of the same application for the same user. One common scenario is when you have the need to deploy a “Production” and a “QA” version of the same application for the same user on the same machine. The main problem with the scenario above is the following:

You can execute two different ClickOnce publications to different Installation URL’s that contain a different App.Config file. One App.config file points to the “Production” database and the other points to the “QA” database.

The problem with this approach is that once a user installs the “Production” application and then installs the “QA” application, the second installation will override the first installation.

The reason for this is that the ClickOnce publication thinks that it is the same application, so, the “Production” app.config will be over written with the “QA” app.config. The end result is that both applications will collide with each other. It will never work.

In order to pull this off, you will  have to change the assembly name and the product name for your application.

The solution is as follows:

  1. Right click on your Start Up Project and select: Properties
  2. On the Application Tab, change the name of the Assembly Name to a different name for the “QA” version of the deployment:
  3. On the Publish Tab, click on the Publish Options… button:
  4. In the Publish Options, change the Product Name:
  5. Publish the Application.

If you follow the steps above, you should now be able to Install two concurrent versions of the same application pointing to two different data bases (environments).

The above instructions were referenced from this blog post by RobinDotNet. She has included a Screen Cast if you would like to check it out.

Have fun with your ClickOnce Application deployments.

HLC


6 responses to “ClickOnce Deployment – Deploying multiple versions of the same application”

  1. I had the version same issue. I knew the solution had to be linked to the assembly name to resolve this, but was not sure if other steps might be required. thanks for the info.

  2. I’ve created https://www.nuget.org/packages/OctoPackPlus.ClickOnce as a way to support multiple environments, within a CI environment, building nuget packages for Octopus Deploy as an agent of Continuous Deployment/Delivery

    To use it, just add a “Deploy” project to your solution, add the nuget package (and dep’s), and fill in the XML files.

    It’ll generate the per-environment builds (and nuget package) for RELEASE builds (most common in CI environments), which are left in the projects’ output folder.

  3. I have checked your blog and i’ve found some duplicate content, that’s why you don’t rank high in google’s search results,
    but there is a tool that can help you to create 100% unique content, search for: Boorfe’s tips unlimited content

  4. I see you don’t monetize your website, don’t waste your traffic, you can earn extra cash every month because you’ve got
    hi quality content. If you want to know how to make extra bucks, search for:
    Ercannou’s essential adsense alternative

  5. I often visit your page and have noticed that you don’t
    update it often. More frequent updates will give your page higher rank & authority in google.
    I know that writing articles takes a lot of time, but you can always help yourself with miftolo’s tools which will shorten the time
    of creating an article to a few seconds.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.