Search code examples
wixcustom-actionwix3.5

Run WiX EXE CustomAction from TempFolder


I'm using WiX 3.5 for the following.

I have some files (an EXE and DLL) that I need to extract to the TEMP folder at the beginning of the installation (before the EULA is displayed), then run the EXE. I have the part working that extracts the files, using http://msiext.codeplex.com/. The code looks like this:

<CustomAction Id="SetBinaryWrite_TargetFileName_1" Property="BINARYWRITE_TARGETFILENAME" Value="[TempFolder]ActivationUtility.exe" />

Notice that [TempFolder] is used and (on Windows 7) resolves to "C:\Users\USERNAME\AppData\Local\Temp\", and this is not "set up" anywhere in my WXS files - it's a Windows property, like ProgramFilesFolder, etc...

I set up my EXE CustomAction like this:

<CustomAction Id="ActivationUtility"
                  Directory="TempFolder"
                  ExeCommand="ActivationUtility.exe"
                  Execute="immediate" Return="check" />

The linker then complains: error LGHT0094 : Unresolved reference to symbol 'Directory:TempFolder'. If I use "[TempFolder]", the compiler complains. Why does this property work for one CustomAction, but not another? What exactly do I need to do to reference the TempFolder for the above CustomAction?


Solution

  • Following code compiles for me (can't test it right now)

    Add this under your root directoy

    <Directory Id="TempTest" FileSource="[TempFolder]"></Directory>
    

    And declare the custom action like this

    <CustomAction Id="ActivationUtility"
                  Directory="TempTest"
                  ExeCommand="ActivationUtility.exe"
                  Execute="immediate" Return="check" />
    

    You can of course change the id of your folder