[wix-users] Custom Action to set a Wix Variable

Brian Enderle brianke at gmail.com
Tue Sep 22 04:47:09 PDT 2015


You don't need to setup the WixVariable, just use "[TEST_VAR]" where ever
you need.  The 'session' call sets the variable in the current session,
making it available throughout your WiX application.

Just like the examples I gave, just use the variable where you need.

Brian

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

On Tue, Sep 22, 2015 at 1:21 AM, Sanket Panchamia <psanket at gmail.com> wrote:

> Hi Brian,
>
> Is this the correct way to do?
>
> In custom action,
> session["TEST_VAR"] = "Test"
>
> In wxs file.
>
> <WixVariable Id="testVar" Value="[TEST_VAR]" />
>
> Thanks
> Sanket
>
> On Mon, Sep 21, 2015 at 5:22 PM, Brian Enderle <brianke at gmail.com> wrote:
>
> > Example using variable as a condition:
> >
> > In the custom action:
> >
> >                     session["FOXPROPATH_VALID"] = "1";
> >
> > and in your wxs file:
> >
> >           <Publish Event="NewDialog" Value="VerifyReadyDlg"
> > Order="4"><![CDATA[FOXPROPATH_VALID = "1"]]></Publish>
> >
> >
> >
> >
> > Example updating an XML file element with variable:
> >
> > In the custom action:
> >
> >             session["ENCRYPTED_PASSWORD"] =
> > PasswordConfig.encryptPassword(_password);
> >
> > and in your wxs file:
> >
> >       <util:XmlFile Id="UpdateEncryptedPassword"
> >                     Action="setValue"
> >                     File="[CONFIGFOLDER]config.xml"
> >                     ElementPath="//DelphiaConfig/DatabaseInfo/Password"
> >                     Value="[ENCRYPTED_PASSWORD]"
> >                     Sequence="3" />
> >
> >
> >
> > Brian
> >
> > If you can't explain it simply, you don't understand it well enough.  -
> > Albert Einstein
> >
> > On Mon, Sep 21, 2015 at 7:24 AM, Sanket Panchamia <psanket at gmail.com>
> > wrote:
> >
> > > Hi,
> > >
> > > Is there a way to write a custom action (c# or vb) that sets a variable
> > > that
> > > can be used back in the main wix project.wxs file?
> > >
> > > Thanks
> > > --
> > > Regards
> > > Sanket Panchamia
> > > +91-9742836299
> > >
> > > <https://twitter.com/p_sanket>  <http://www.facebook.com/spanchamia>
> > > <http://www.linkedin.com/in/psanket>
> > >
> > > ____________________________________________________________________
> > > WiX Toolset Users Mailing List provided by FireGiant
> > > http://www.firegiant.com/
> > >
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant
> > http://www.firegiant.com/
> >
>
>
>
> --
> Regards
> Sanket Panchamia
> +91-9742836299
>
> <https://twitter.com/p_sanket>  <http://www.facebook.com/spanchamia>
> <http://www.linkedin.com/in/psanket>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>


More information about the wix-users mailing list