locked
Uninstall Custom Action no longer being called RRS feed

  • Question

  •  

    I have a setup and deployment project that is using custom actions. The custom action is an installer .dll. For some reason the uninstall method isn't being called when uninstalling the msi package anymore. The install method is called correctly on install and the uninstall used to work. Does anyone have any thoughts?
    Tuesday, October 30, 2007 2:44 PM

All replies

  • It looks like the problem was due to me setting the installer dll to be permanent in the setup project. To fix the problem I had to set the permanent property back to false and change the upgradecode guid and rebuild the project. I expected this flag to just leave the files after uninstall not to diasble the custom action. Anyone have any thoughts on why this is?

    Wednesday, October 31, 2007 1:13 PM
  • I'm facing the similar problem here, see my recent post:

     

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2461789&SiteID=1

     

    But so far nobody answers my post. Are you using Windows Vista?

    Tuesday, November 27, 2007 9:46 AM
  • In Windows Installer there is no built-in idea of an uninstall custom action.  There are just custom actions, and whether they run or not depends on them having a condition attached to them. The condition that Visual Studio sometimes creates behind your back to make a custom action be an uninstall custom action is to condition it on the installer component being uninstalled. If you have marked it permanent it will never be uninstalled so the uninstall custom action will never be called. Some custom actions can be marked Exclude=True, and in those cases you get a condition based on the product being uninstalled. That probably wouldn't work for you if you really want the file to never be uninstalled.

    Tuesday, November 27, 2007 11:38 PM
  • I neither set my exe to Permanent=True nor Exclude=True. I also never put any value to the Condition property. There are only two properties I specified for my custom uninstall action: Arguments and InstallerClass=False. I have just setup a WinXP virtual machine and tested it, the result was exactly the same as what my friend told me -- it works. I suspect that it has something to do with Windows Vista.

     

    For a tweak, however, I tried creating an InstallerClass DLL to replace the EXE. In the BeforeUninstall event, I use Process.Start to call my EXE, it works like a champ. And the good thing, Windows Installer automatically removes the InstallerClass DLL after the uninstallation, leaving nothing behind (unless you have some other files created somewhere in the application folder since the last install). This solution works for both WinXP and Vista.

     

    Although InstallerClass DLL does not support arguments, I can try using the CustomActionData property.

     

    Thanks.

    Wednesday, November 28, 2007 12:41 PM