[wix-users] Pass Local Variable to CustomAction

Brian Enderle brianke at gmail.com
Mon Mar 6 13:13:44 PST 2017


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


More information about the wix-users mailing list