I think I know what is going on. Lets say I have 2 versions 1.0 and 2.0. The first one is installed and I'm upgrading to the second. Here's what I think happens: - installer 2.0 starts up - installer 2.0 checks the condition for CloseMyApp. !MyAppFeature is 2, &MyAppFeature is 3. Nothing happens, because the condition is false - installer 2.0 runs the Restart Manager. It detects that the EXE is in use and asks me to close it - installer 2.0 runs uninstaller 1.0 - uninstaller 1.0 checks the condition for CloseMyApp. !MyAppFeature is 3, &MyAppFeature is 2 and the action runs. However the EXE is already gone - uninstaller 1.0 runs the Restart Manager, but there is nothing to restart
So looks like I'm barking up the wrong tree. I was thinking that the EXE should be closed as part of the uninstall process of 1.0. But instead, it should be done even before uninstaller 1.0 is launched. What's worse - the installer 2.0 has no idea where the EXE is located, since the previous version can be installed in a different folder. My solution is to add a new helper tool, whose purpose is to look for the EXE that needs closing and shut it down if it exists. It looks in the registry to find the install folder of the previous version. I also changed my condition to this: ((!MyAppFeature=3) AND (&MyAppFeature=2)) OR PREVIOUSVERSIONSINSTALLED This way it will be triggered during uninstall if the feature is present, and on upgrade no matter what. The action may run in some cases when it shouldn't, but no harm done since the helper tool will not find the EXE and quit silently. The solution works, but it's a bit hacky. This makes me think there must be a better way. Any ideas? I doubt I'm the first person to hit this problem. Ivo Ivo Beltchev wrote: > OK, so now my condition is "(!MyAppFeature=3) AND (&MyAppFeature<>3) AND > (&MyAppFeature<>-1)". It works fine during install, uninstall, change or > repair. > But it doesn't seem to work during an upgrade (it's a major upgrade). I > changed it to: > > (!MyAppFeature=3) AND ((&MyAppFeature=2) OR UPGRADINGPRODUCTCODE) > > Basically what I mean is "if the feature is present, and it is being > uninstalled or upgraded". But the action doesn't run. My guess is > UPGRADINGPRODUCTCODE is not set yet, since the action is before > InstallValidate. Is there another way to detect an upgrade before > InstallValidate? > > Ivo > > > Blair wrote: > >> &MyAppFeature is documented to be -1 when MyAppFeature will be left alone by >> the installation transaction. >> >> From: http://msdn.microsoft.com/library/aa368012.aspx >> >> INSTALLSTATE_UNKNOWN -1 No action to be taken on the feature or component. >> >> -----Original Message----- >> From: Ivo Beltchev [mailto:i...@roadrunner.com] >> Sent: Saturday, June 26, 2010 2:23 PM >> To: General discussion for Windows Installer XML toolset. >> Subject: Re: [WiX-users] Problem with "Close App" condition >> >> Hmm... could be. >> Is it possible that &MyAppFeature is not initialized yet because I'm >> running before "InstallValidate"? I have to run before InstallValidate, >> because I want to run before the Restart Manager pops up and asks to >> close the app for me. >> >> What is the recommended way to debug such problems? Is there a tool that >> can trace through the install process? >> >> Blair wrote: >> >> >>> If your feature won't be affected at all by the transaction (such as when >>> removing a different feature) &MyAppFeature may very well be -1, which >>> >>> >> would >> >> >>> make your condition be true. >>> >>> -----Original Message----- >>> From: Ivo Beltchev [mailto:i...@roadrunner.com] >>> Sent: Saturday, June 26, 2010 8:11 AM >>> To: General discussion for Windows Installer XML toolset. >>> Subject: [WiX-users] Problem with "Close App" condition >>> >>> Hi >>> >>> I have a custom action that closes my app when its feature is being >>> uninstalled. Here's my code: >>> >>> <Custom Action="CloseMyApp" >>> Before="InstallValidate"><![CDATA[(!MyAppFeature=3) AND >>> (&MyAppFeature<>3)]]></Custom> >>> >>> For some reason the action gets triggered during "Repair" and also when >>> ANOTHER feature is being uninstalled. Why is this happening? Doesn't my >>> condition mean "if MyAppFeature is installed, and about to be >>> >>> >> uninstalled"? >> >> >>> Thanks >>> Ivo >>> >>> >>> >>> >>> >> ---------------------------------------------------------------------------- >> >> >>> -- >>> This SF.net email is sponsored by Sprint >>> What will you do first with EVO, the first 4G phone? >>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >>> _______________________________________________ >>> WiX-users mailing list >>> WiX-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/wix-users >>> >>> >>> >>> >>> >> ---------------------------------------------------------------------------- >> -- >> >> >>> This SF.net email is sponsored by Sprint >>> What will you do first with EVO, the first 4G phone? >>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >>> _______________________________________________ >>> WiX-users mailing list >>> WiX-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/wix-users >>> >>> >>> >>> >> ---------------------------------------------------------------------------- >> -- >> This SF.net email is sponsored by Sprint >> What will you do first with EVO, the first 4G phone? >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >> _______________________________________________ >> WiX-users mailing list >> WiX-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wix-users >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Sprint >> What will you do first with EVO, the first 4G phone? >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >> _______________________________________________ >> WiX-users mailing list >> WiX-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wix-users >> >> >> > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > > ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users