OK, Thanks to Steven for pointing me in the right direction, I now have 
a solution that works fine for me. Here's the WiX source:

       <InstallExecuteSequence>
           <Custom Action="ScriptForInstall" After="InstallInitialize" />
           <Custom Action='ScriptForRemove' 
Before='ScriptForInstall'>(NOT UPGRADINGPRODUCTCODE) AND 
(REMOVE="ALL")</Custom>
       </InstallExecuteSequence>


       <CustomAction Id="ScriptForInstall"
              Directory="MyProgram_1"
             ExeCommand="cmd.exe /c &quot;[MyProgram_1]Util1.bat&quot;"
                 Return="ignore"
                Execute="commit"
            Impersonate="no"/>

       <CustomAction Id="ScriptForRemove"
              Directory="MyProgram_1"
             ExeCommand="cmd.exe /c &quot;[MyProgram_1]Util2.bat&quot;"
                 Return="check"
                Execute="deferred"
            Impersonate="no"/>

The above causes a script (util1.bat) to be kicked off after all the 
files have been unpacked and causes a different script (util2.bat) to be 
run BEFORE removing the files that were unpacked by the original 
install. Works great! thanks for the help!

Vern


On 3/12/2013 3:05 PM, Steven Ogilvie wrote:
>
> You could have a custom action that has an execute sequence for both 
> install and uninstall or one or the other...
>
> Depends on what custom actions you need...
>
> On install, it is not installed yet, so NOT Installed custom action 
> would only occur when the product has not been installed. Setting the 
> Custom action sequence to "Installed" means only run this when the 
> product has been installed(but that could mean a 
> "Change/Repair/Remove" so you have to be careful, hence I put 
> "Installed and Not REINSTALL" which means it would not run on an 
> Install or repair but a remove...
>
> Steve
>
> *From:*Vern Graner [mailto:v...@txis.com]
> *Sent:* March-12-13 2:59 PM
> *To:* General discussion for Windows Installer XML toolset.
> *Subject:* Re: [WiX-users] Execute a custom action only on uninstall?
>
> Steve:
>
> Thanks for the reply. I hadn't had a chance to experiment with this 
> till today. I was looking at the two "<InstallExecuteSequence>" 
> sections you show below and I guess I'm just not getting what makes 
> the script only execute the <customaction> only on *UNinstall*, and 
> not on install?
>
> Also, is the second example (the one labeled "Now let's do something 
> for uninstall:") an addition to the first one as in would both of 
> those code pieces be included to make a working example?
>
> Vern
>
> On 3/5/2013 1:02 PM, Steven Ogilvie wrote:
>
>     Classification: Public
>
>       
>
>       
>
>     You use the install sequence to set up your custom actions...
>
>       
>
>     So let's say I have custom action 1 which does something during install:
>
>       
>
>     <CustomAction Id=" CA_Set_Something " Property="SOME_PROPERTY" 
> Value="[ComputerName]"/> <UI>
>
>           <ProgressText Action=" CA_Set_Something ">CA: Setting a 
> property...</ProgressText> </UI>
>
>       
>
>     <InstallExecuteSequence>
>
>     <Custom Action="CA_Set_Something" After="InstallValidate">NOT 
> Installed</Custom>
>
>       
>
>     Now let's do something for uninstall:
>
>       
>
>     <CustomAction Id="CA_Set_DELETE_SOME_FILE" Property=" CA_DELETE_SOME_FILE 
> " Value="[SOME_PATH]\MyFile.txt|"/> <CustomAction Id="CA_ DELETE_SOME_FILE " 
> BinaryKey="BIN_CustomAction" DllEntry="RemoveFileOnUninstall" 
> Impersonate="no" Execute="deferred" Return="ignore"/> <UI>
>
>          <ProgressText Action="CA_ DELETE_SOME_FILE ">CA: Delete some 
> file...</ProgressText> </UI>
>
>       
>
>     [InstallExecuteSequence]
>
>     <Custom Action=" CA_Set_DELETE_SOME_FILE" 
> After="InstallValidate">Installed and Not REINSTALL</Custom>
>
>       
>
>     <Custom Action="CA_DELETE_SOME_FILE" After="InstallFiles">Installed and 
> Not REINSTALL</Custom>
>
>       
>
>     Steve
>
>
>
> -- 
> Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
> Senior Systems Engineer    | obviously incompetent so why are we
> Texas Information Services | paying you? Of course, if the network
> http://www.txis.com         | is up, then we obviously don't need
> Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG

-- 
Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
Senior Systems Engineer    | obviously incompetent so why are we
Texas Information Services | paying you? Of course, if the network
http://www.txis.com        | is up, then we obviously don't need
Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to