locked
Uninstall RRS feed

  • Question

  • Hello All,

    Please tell me how to write code in VB.NET to Uninstall an application. I need to include this in an existing setup .

    Urgent !! Please help

    Warm Regards,
    Lisha
    Thursday, October 6, 2005 10:45 AM

Answers

  • Hello.
    Just so that I have said it: You should have a really good reason for doing this. I can't say I can imagine why you shouldn't ask the user to remove the program with add/remove programs.

    Still, if it is urgent, here goes:

    You would need to find the program by searching registry in the folders directly under

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

    1) Search for name matching the application to remove in regkey:"DisplayName"
    If you find it
    2a) Open a "Process" specified by regkey:"UninstallString"
    2b) On successful completion: Remove the registry key (the folder containing the two values)

    Remember: your program will most likely need the same priveleges you need for doing this manually (with add/remove programs).

    No garanties given (you might destroy your users installation, at least in their point of view).

    Again: do this only if you have to. Good luck

    Hope this helps,
    Gorm Braarvig.
    Thursday, October 6, 2005 7:04 PM

All replies

  • I thought that when you create a setup in .net it adds a uninstal option in:  control panel/(add/remove)

    Remco
    Thursday, October 6, 2005 12:34 PM
  • Hello.
    Just so that I have said it: You should have a really good reason for doing this. I can't say I can imagine why you shouldn't ask the user to remove the program with add/remove programs.

    Still, if it is urgent, here goes:

    You would need to find the program by searching registry in the folders directly under

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

    1) Search for name matching the application to remove in regkey:"DisplayName"
    If you find it
    2a) Open a "Process" specified by regkey:"UninstallString"
    2b) On successful completion: Remove the registry key (the folder containing the two values)

    Remember: your program will most likely need the same priveleges you need for doing this manually (with add/remove programs).

    No garanties given (you might destroy your users installation, at least in their point of view).

    Again: do this only if you have to. Good luck

    Hope this helps,
    Gorm Braarvig.
    Thursday, October 6, 2005 7:04 PM