ClickOnce application replace current installed fliles

With ClickOnce applications, is it possible to replace the current files or install in a different directory when creating a new version? Because the error I get is:

Unable to install this application because an application with the same identity is already installed. To install this application, either modify the manifest version for this application or uninstall the preexisting application.


Solution 1:

As the error message says, there are two options.

First, you as a developer should modify the version number of the ClickOnce manifest. This is done at the ClickOnce tab of the project settings. Note that ClickOnce version has nothing in common with your assembly (assemblies) version.

Another option is to uninstall the application and unfortunately, this probably has to be done manually. You have to find the ClickOnce deployment folder (C:\Users\username\AppData\Local\Apps\2.0) and manually delete all folder contents. This can also be done by invoking the

 rundll32 dfshim CleanOnlineAppCache

command from the commandline.

Solution 2:

When I encountered this error it is because I wanted two different install locations for the same program. Specifically Program_A was published to two spots online and after changing a small thing in the program, I wanted them to both be installed on the same machine, but from different ClickOnce links.

So after receiving that error, instead of attempting to tweak the manifest I changed the options. Project Settings -> Publish -> Options -> I edited [Published Name, Suite name:, Product name:]. You may not have to change all three.

I now have both installs running. ClickOnce will install in a different directory, but it will remove the first desktop shortcut.

If you dont want to go that route, manifest information is here.
https://msdn.microsoft.com/en-us/library/ws1c2fch.aspx

And your manifest is usually is located under bin/debug(release)/yourprogramname.application.

Solution 3:

I also found that both rundll32 dfshim CleanOnlineAppCache or mage.exe -cc don't seem to work, I still get the same error.

I have manually deleted the deployment folder.

On Windows XP the path to deployment folder would be C:\Documents and Settings\UserName\Local Settings\Apps.