Reputation: 763
It's basically all in the title, but I'l still explain further.
ClickOnce applications are meant by design to be easily installed without admin rights. However, to rollback a ClickOnce application to its previous version, you must use Add/Remove Programs feature, as explained in Microsoft documentation.
The problem is that in my enterprise, a specific policy prevents users from using this feature. Running appwiz.cpl as Administrator won't help here because ClickOnce applications are installed by user.
So is there any other way to rollback a ClickOnce application to its previous version ?
Thanks for your answers.
Upvotes: 0
Views: 3466
Reputation: 11877
You can write a small program that will do this. You can take the uninstall code found here. The uninstall will always display a dialog asking the user if he's sure. The code searches that dialog for the OK button and clicks it. You could always modify this to look for the button (I can't remember the text) that reverts a version, and select it, before clicking the OK button.
Upvotes: 0
Reputation: 185643
At one of my previous jobs, we didn't give our users the option of whether or not to upgrade; each version was pushed out with its version as the minimum version. This did, however, have the nasty side-effect of not allowing users to downgrade in the event that something went wrong in the new version.
To get around this, every time we'd publish a version, we would publish the same version a second time to a different location but with the version incremented twice (in other words, with a version that would be higher than the next version we'd publish). In the event that we had to roll back, we just needed to copy the version from the secondary location into the primary location and overwrite the main .application file with the one from that specific version.
This does require that you be somewhat disciplined with your versioning, since the whole approach depends on the backup version being higher than the next-higher current version so that ClickOnce thinks it's actually newer. You don't want to make the version too high, since whatever version you publish to replace it must naturally have a version higher than that as well.
For example, it might go something like this:
Publish version 1.0.0 to primary location and 1.2.0 to backup location
Clients update
Publish version 1.1.0 to primary location and 1.3.0 to backup location
Clients update
Calamity ensues
Copy version 1.2.0 from backup to primary (which is, in reality, version 1.0.0)
Clients update
All is well
Publish version 1.3.0 to primary location and 1.5.0 to backup location
etc.
There are a couple of restrictions:
Upvotes: 1