WiX - accessing exe within a harvested folder

31 views Asked by At

In my project I have had to harvest 2 folders which happen to contain duplicate exes I use in custom actions - to achieve this I have set the wixproj value 'supress root directory' to false - meaning the folder the files are contained within is also packaged into the INSTALLFOLDER.

However, this now means my custom actions/exes are not running and I assume it is due to this directory change (I have tested it works when supressing directory = true)

this is the directory structure

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="APPLICATIONROOTDIRECTORY">
        <Directory Id="INSTALLFOLDER" Name="MyInstaller">
            <!--Files install here-->
        </Directory>
    </Directory>
</Directory>

so far I have tried passing the name of the installed folder - HARVESTEDFOLDER - into the custom action:

<CustomAction Id="RunIt" Directory="INSTALLFOLDER"
              ExeCommand="[INSTALLFOLDER][HARVESTEDFOLDER]run_it.cmd" Execute="deferred" Impersonate="no" Return="asyncNoWait" />

however this does not seem to work. Is this simply wrong or is there a better way to access the exe?

thank you :)

1

There are 1 answers

0
Rob Mensching On

There is an easy way to do what you want to do and a hard way:

  1. Easy way is to use the advanced harvesting tools and its HarvestFile element to be able to directly reference the file. If you prefer video to documentation, I covered this in S1:53 in the Deployment Dojo using WiX v4. It works similarly in WiX v3, but you need to install the WiX Expansion Pack instead of the HeatWave Build Tools.

  2. Hard way is to use XSLT with heat.exe to either filter away the file and specify it directly or add an id to the file during harvesting. I covered the first option in episode S1:52 of the Deployment Dojo using WiX v4. Much of that is similar to WiX v3 but you reference heat.exe differently.