C# – Upgrade an existing application to include ClickOnce

automated-deploycclickoncedeploymentvisual-studio-2008

Is it possible to introduce ClickOnce functionality to an existing application?

The scenario is: Version 1.0 is already installed on client premises. I would like to send them a new setup package which will upgrade to 1.1, which has ClickOnce functionality, thereby making future upgrades "effortless".

Barring that, are there any other solutions to this sort of problem?

P.S.: The original application was developed with Visual Studio 2005 (that is, .NET 2.0). I'm using Visual Studio 2008 now.

Best Answer

No, it is not possible with a standard ClickOnce deployment scenario.

ClickOnce is a sandboxed installation on the client side. It will not know about version 1.0 that's already installed. It is simply going to check to see whether its GUID has already been installed via ClickOnce and if so update it, but only if the previous version was deployed via ClickOnce.

In your case, if the user installed Version 1.1, both versions will be installed side by side. Version 1.0 will not be updated, because ClickOnce doesn't know there's an association since it was deployed via a different method. If they don't want version 1.0 anymore, they'll need to remove it manually. Once you've got version 1.1 deployed via ClickOnce, subsequent updates will work correctly.

Don't think of ClickOnce as something you're "including", think of it as a method of deployment.

Alternatively:

I should clarify that what you're looking for is not possible with standard ClickOnce deployment. However, you mentioned you're going to send them an initial setup file. In that case you may have a workaround that's possible:

  1. Script the setup file to remove the version 1.0 installation automatically
  2. Script the setup file to launch the ClickOnce installation.

For subsequent updates, simply point the user to the "pure" ClickOnce setup package, and your updates should work fine.