[wix-users] Pass Local Variable to CustomAction

Brian Enderle brianke at gmail.com
Mon Mar 6 14:27:51 PST 2017


I just realized it was a separate issue, I forgot to include this

      <Custom Action='AssignProductVersion_CA'
After='AssignConfigPath_CA'>NOT REMOVE</Custom>

in the <InstallExecuteSequence>

After adding this, the following works:

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

Thanks for your help,


Brian

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

On Mon, Mar 6, 2017 at 5:17 PM, Hoover, Jacob <Jacob.Hoover at greenheck.com>
wrote:

> Can you show me the definition of the CA in your WXS?  Is it an immediate
> or deferred CA?
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf
> Of Brian Enderle
> Sent: Monday, March 06, 2017 3:56 PM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Subject: Re: [wix-users] Pass Local Variable to CustomAction
>
> I can already reference my variables using $(var.ShortAssyVersion).
>
> My issue is using this variable when calling a CustomAction.  The value
> for @(var.ShortAssyVersion is not making it to the session of the
> CustomAction.
>
> Brian
>
> If you can't explain it simply, you don't understand it well enough.  -
> Albert Einstein
>
> On Mon, Mar 6, 2017 at 4:22 PM, Hoover, Jacob <Jacob.Hoover at greenheck.com>
> wrote:
>
> > 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/
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant
> > http://www.firegiant.com/
> >
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>


More information about the wix-users mailing list