Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to initiate an uninstall of a ClickOnce app, from within the app?

Can I reliably initiate the un-installation of a ClickOnce app, from within the app?

In other words, I want to give the user a big "Uninstall Me Now" button on one of the forms. When a user clicks the button, I want to start the windows uninstall process for this app, and perhaps close the app.

Reason: We are dead-ending a ClickOnce app and want to make it as easy to remove as it was to install. We don't want to send them down the path to "Add or Remove Programs" and risk them getting lost or distracted.

Can this be done reliably?

like image 774
dwolvin Avatar asked Apr 19 '10 23:04

dwolvin


1 Answers

I'd recommend checking out this MSDN article here. It explains how to programmatically uninstall an app (and reinstall from a new URL if you want to):

http://msdn.microsoft.com/en-us/library/ff369721.aspx

This is a variant on the jameshart blog entry, but it includes a couple of fixes that you're going to want to use. There are code downloads in both C# and VB.

In fact, you can just push an update and have the app uninstall itself, you don't even need the user to say "ok".

like image 111
RobinDotNet Avatar answered Sep 18 '22 14:09

RobinDotNet