[wix-users] use WixVariables recursively?

Reuss, Matthias matthias.mr.reuss at sivantos.com
Fri Jul 27 02:36:39 PDT 2018


Hello,

For setting some source paths, I have used preprocessor variables so far, which I set up recursively:

  <?define ProjectRoot="$(var.SolutionDir)..\"?>
  <?define OutputFolder="$(var.ProjectRoot)Output"?>
  <?define CustomDllPath="$(var.OutputFolder)\Installation\bin\$(var.Configuration)\"?>

Now I would like to use WixVariables instead. I put these together with some other globally valid elements into a wixlib:

<Fragment>
    <WixVariable Id="ProjectRoot" Value="$(var.SolutionDir)\.."/>
    <WixVariable Id="OutputFolder" Value="!(wix.ProjectRoot)\output"/>
    <WixVariable Id="CustomDllPath" Value="!(wix.OutputFolder)\Installation\bin\$(var.Configuration)"/>

    <Binary Id="CustomAction.dll" SourceFile="!(wix.CustomDllPath)\MyCustomActions.CA.dll" />
</Fragment>

In my product.wxs file, I then refer this fragment:


    <CustomAction Id="MyCA" BinaryKey="CustomAction.dll" DllEntry="MyCA" Execute="firstSequence" />

    <InstallExecuteSequence>
      <Custom Action="MyCA" After="AppSearch" />
    </InstallExecuteSequence>

This gives me the light error
error LGHT0103: The system cannot find the file '!(wix.OutputFolder)\Installation\bin\Release\MyCustomActions.CA.dll'.

If I modify my wixlib to not use the WixVariables recursively:
<Fragment>
    <WixVariable Id="ProjectRoot" Value="$(var.SolutionDir)\.."/>
    <WixVariable Id="OutputFolder" Value="$(var.SolutionDir)\..\output"/>
    <WixVariable Id="CustomDllPath" Value="$(var.SolutionDir)\..\output\Installation\bin\$(var.Configuration)"/>

    <Binary Id="CustomAction.dll" SourceFile="!(wix.CustomDllPath)\MyCustomActions.CA.dll" />
</Fragment>

my product builds fine.

So it seems to me that the binder does not resolve these WixVariables recursively, which would be very helpful e.g. in order to define a source directory tree.

I have not found anything about this in the documentation.

Is there another possibility to define a source directory tree without having to rely on preprocessor variables?

Best regards

Matthias Reuss


More information about the wix-users mailing list