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:
The sometimes difficulty of updating a deployed application.
The impact of an application on a user’s computer system.
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:
- Right click on your Start Up Project and select: Properties
- On the Application Tab, change the name of the Assembly Name to a different name for the “QA” version of the deployment:
- On the Publish Tab, click on the Publish Options… button:
- In the Publish Options, change the Product Name:
- 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.