[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:

    <DefineConstants>
      $(DefineConstants);
      UpgradeCode=$(UpgradeCode);
      ProductName=$(ProductName);
    </DefineConstants>

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">
    <GetAssemblyIdentity
AssemblyFiles="$(SolutionDir)MyProject\bin\MyProject.exe">
      <Output TaskParameter="Assemblies" ItemName="AssemblyVersions" />
    </GetAssemblyIdentity>
    <CreateProperty Value="%(AssemblyVersions.Version)">
      <Output TaskParameter="Value" PropertyName="AssyVersion" />
    </CreateProperty>
    <CreateProperty
Value="$(AssyVersion.Split('.')[0]).$(AssyVersion.Split('.')[1]).$(AssyVersion.Split('.')[2])">
      <Output TaskParameter="Value" PropertyName="ShortAssyVersion" />
    </CreateProperty>
  </Target>

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'
                  Property='PRODUCT_VERSION'
                  Value='[ShortAssyVersion]' />

and

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

How can I pass this value to the CustomAction?


Brian

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