[wix-users] Pass Local Variable to CustomAction

Hoover, Jacob Jacob.Hoover at greenheck.com
Mon Mar 6 13:22:31 PST 2017

You need to modify the DefineConstants Property in the wixproj.  Normally I property drive the application, so I can just do:


And then they can be referenced in wxs via $(var.UpgradeCode).

Since your property is being defined inside a target, you would have to do the MSBuild magic to update it.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Brian Enderle
Sent: Monday, March 06, 2017 3:14 PM
To: WiX Users <wix-users at lists.wixtoolset.org>
Subject: [wix-users] Pass Local Variable to CustomAction

I have a local variable created as a PreBuild event as follows:

  <Target Name="BeforeBuild">
      <Output TaskParameter="Assemblies" ItemName="AssemblyVersions" />
    <CreateProperty Value="%(AssemblyVersions.Version)">
      <Output TaskParameter="Value" PropertyName="AssyVersion" />
      <Output TaskParameter="Value" PropertyName="ShortAssyVersion" />

Basicaly, I am creating a Major.Minor.Build number (no Revision).

I would like to pass this value to a CusotmAction.  I have tried both of the following but neither works:

    <CustomAction Id='AssignProductVersion_CA'
                  Value='[ShortAssyVersion]' />


    <CustomAction Id='AssignProductVersion_CA'
                  Value='$(var.ShortAssyVersion)' />

How can I pass this value to the CustomAction?


If you can't explain it simply, you don't understand it well enough.  - Albert Einstein

WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

More information about the wix-users mailing list