Every ClickOnce application installed on a local computer has a data directory, stored in the user's Documents and Settings folder. Any file included in a ClickOnce application and marked as a "data" file is copied to this directory when an application is installed.
With a project selected in Solution Explorer, on the Project menu, click Properties. Click the Publish tab. Click the Updates button to open the Application Updates dialog box. In the Application Updates dialog box, make sure that the The application should check for updates check box is cleared.
In the project properties, Signing tab: Untick "Sign the ClickOnce manifests"
You can revert back to an older version on the server side by changing the server manifest file. When the client restarts the application, it will see that it has a different version than what the server says is the 'current' version, and it will download the new one. This server manifest file usually always points to the most recent version, but it doesn't have to.
Here's how to change it (I published using Visual Studio 2008. Other versions might have a different publish folder structure).
In the same folder as the publish.htm is an XML document called [appName].application
. This is the server-side manifest file that the client uses to compare its current version against. Contained in this document includes the 'current' version that the client should be running as well as the location on the server that the deployment files can be found.
In the same location as the publish.htm
is also a folder called 'Application Files'. This folder contains subfolders for each of the previous publishes. Within each of these sub-folders is another XML document with the same name I mentioned above called [appName].application
. Copy this file (from whatever folder that contains the version you want to revert back to) and paste it into the same folder as publish.htm
(a couple of levels up). When the client application restarts, it will appear just like a new version is available, download it, and run it. The client will now be running a previous version.
ClickOnce will use whatever version you send them. If you send them an old version, they will rollback to that old version.
Back in May my buddy David wrote an article on how to do this on a per-user basis. We can literally have every user on a different version. The application even tells the database which version the user wants, so they could in theory change their version and then simply restart the application.
Fine Grained Versioning with ClickOnce
You can go in Add/Remove application and select your application and choose to get the last installation instead.
Just used this to roll back a clickonce application developed in Visual Studio 2017. In my case, in the root folder, there were just two files; one called [applicationName].manifest, the other setup.exe.
The [applicationName].manifest contained a number references to the current version number but each were linked to a publicKeyToken value so I was reluctant to manually edit it.
So, in the Application Files folder, under to the sub folder containing the version I wanted to roll back to, I found another [applicationName].manifest, which I copied to the root folder (having backed up the original).
And that was it. It worked for me and was a really simple solution. However I'm not using a minimum required version so can't say whether that would affect it.
You can use MAGEUI to rollback to a previous manifest version on the server. Check this out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With