0

I am trying to pass INSTALLDIR to a deferred CustomAction with ExeCommand and for the purpose of making the reproducible simple, I am just calling echo [CustomActionData]. I have the following code:

    <CustomAction Id="SetInstallationDirectory" Property="RunEcho" Value="[INSTALLDIR]" />

    <CustomAction Id="SetFoldersFilesToNotWrite"
                  Property="CmdPath"
                  Value="cmd.exe" />

    <CustomAction Id="RunEcho"
                  Execute="deferred"
                  Impersonate="no"
                  Property="CmdPath"
                  ExeCommand='/c echo "[CustomActionData]"'
                  Return="ignore" />
                  
    <InstallExecuteSequence>
        <Custom Action="SetInstallationDirectory" After="CostFinalize">NOT Installed</Custom>
        <Custom Action="SetFoldersFilesToNotWrite" After="CostFinalize">NOT Installed</Custom>
        <Custom Action="RunEcho" After="InstallFiles">NOT Installed</Custom>
    </InstallExecuteSequence>

Running the produced built installer, the log shows:

MSI (s) (BC:6C) [19:01:42:524]: PROPERTY CHANGE: Adding RunEcho property. Its value is 'c:\InstallerTest\'.
...
MSI (s) (BC:6C) [19:01:53:213]: Executing op: ActionStart(Name=RunEcho,,)
Action 19:01:53: RunEcho. 
MSI (s) (BC:6C) [19:01:53:214]: Executing op: CustomActionSchedule(Action=RunEcho,ActionType=3186,Source=cmd.exe,Target=/c echo "",CustomActionData=c:\InstallerTest\)
...

As you can see in the log, CustomActionData is printed with the correct value of the directory, however the command evaluates to /c echo "" and not /c echo "c:\InstallerTest\".

What is wrong with this code?

Note: I am stuck at WiX v3.14.1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.