3

I need my application to uninstall itself.

Reason: It's come to my attention that my app is destroying its own files (my bad), but the user of my app doesn't understand why he needs to uninstall it and refuses to uninstall it. However, he still complains about the constant problems. And in the Terms Of Use, there is a line that says "...we reserve the right to remove the application from your computer and temporarily or permanently discontinue your use of the software."

So, I did some searching on how to uninstall a program, (which will be replaced by a new version), and came across Uninstall C# windows application from self and the accepted answer says you need a 'product code'. What exactly is that, and where can I find/get it from? I have searched for this but can't find anything.

Thank you

Community
  • 1
  • 1
  • Which technology did you use for creating your applications installer? – Doc Brown Mar 05 '11 at 21:50
  • 5
    You mean you reserved the right to uninstall the application w/o user consent, but you don't know how to exert that right? How ironic... – Remus Rusanu Mar 05 '11 at 21:51
  • @Doc Brown - I used the built-in publish feature with Visual Studio 2010 Express, which uses Windows Installer 3.1. –  Mar 05 '11 at 21:56
  • I'm not even sure those terms of use are legal unless the user has leased the software for a specific period or time. Otherwise, that's like a product manufacturer saying they reserve the right to reclaim your product whenever they want. Seems as if you should allow the client to decide if they want to allow you to fix the bug or just live with the application as-is. – Metro Smurf Mar 05 '11 at 22:06
  • 1
    See http://stackoverflow.com/questions/673233/wmi-installed-query-different-from-add-remove-programs-list – Remus Rusanu Mar 05 '11 at 22:18
  • Well, the Terms Of Use was written by out lawyers, so I'm assuming it is legal. As far as I'm concerned, if the customer signed the agreement, then I don't see why we can't do this. PLUS - Credit cards, bank cards, Club cards, reserve the right to take the carde away from you as it is their property, not yours (In Australia, anyway) - ALSO, the customer constantly complains about these problems and says "FIX IT!", so, all I am doing anyway is granting his wish, I am fixing the problem. Step 1: Uninstall Software, Step 2: Install new version. :-) –  Mar 05 '11 at 22:19
  • ...continued from above. - The customer has never stated that he didn't want me to uninstall it, he has only stated that he won't uninstall it himhself, because he doesn't understand. (But he refuses to understand because he doesn't like computers) - And by him constantly saying "FIX IT!", he is, in effect, giving me permission to fix the problem the only way I can, by uninstalling it from his computer. –  Mar 05 '11 at 22:26
  • @Lucifer - the original question omitted that you'll be installing a new version to fix the bug. Credit cards / bank cards are not material product; we don't actually purchase a credit card. Whereas we do purchase material goods such as software, books, etc... Hopefully you can get this fixed up. I've been in similar situations with clients who have no idea how to uninstall an application and I ended writing a self-uninstaller like you are doing now. While it was a learning experience, I really had better things to do. – Metro Smurf Mar 05 '11 at 22:32

3 Answers3

4

The productcode can be obtained from your MSI by opening with orca, the msi db editor and lookup the productcode in the Property table. Orca is part of the Windows SDK.

You can also run your msi

msi /i [your msi] -lvx* log.log

and harvest the productcode from the log.

The easiest way is by getting it from the author files of your setup as Ken White already pointed out.

rene
  • 41,474
  • 78
  • 114
  • 152
2

You created the product code (if it exists) when you created your MSI to install your application. You need the same product code you used in the installation in order to uninstall it via Windows Installer.

Ken White
  • 123,280
  • 14
  • 225
  • 444
  • The product code is created automatically; And from what I can see, there's no way to find it just by looking for it in the Project Properties etc. –  Mar 05 '11 at 21:57
  • Is the product code the same as GUID? If so, then I've got it. –  Mar 05 '11 at 21:58
1

I am not sure about VS 2010, but in VS2008 setup projects have a ".vdproj" project file, which can be opened with a simple text editor (like notepad). If you search for the word "ProductCode", you will find a line like

 "ProductCode" = "8:{GUID}"

(the GUID is what you are looking for).

Doc Brown
  • 19,739
  • 7
  • 52
  • 88
  • Thank you - I can find the GUID from within VS Project Properties :) –  Mar 05 '11 at 22:21