There are different layers of variables in WiX (candle's preprocessor
variables, Light's WixVariables/localization variables/binder variables, and
MSI's properties). Each have different syntax and are evaluated at different
times:

Candle's preprocessor variables "$(var.VariableName)" are evaluated when
candle runs, and can be set from candle's commandline and from "<?define
VariableName=value?>" statements. Buildtime environment properties as well
as custom variables can also be accessed similarly (changing the "var."
prefix with other values).

Light's variables accessible from the command-line are the WixVariables, and
accessing them is via the "!(wix.VariableName)" syntax. To access your
variable from your commandline, you would need to change your String to:
<String Id="WelcomeDlgDescription3" Overridable="yes">This build was
prepared on !(wix.BuildMachine)</String>

If you instead need to have the BuildMachine value exist as an MSI property
at installation time (which is the "[VariableName]" syntax) you would need
to add the following to one of your wxs files in a fragment that is already
linked in:

<Property Id="BuildMachine" Value="!(wix.BuildMachine)"/>

Now, the environment variable COMPUTERNAME always has held the name of my
build machines in the past, and you can access that this way:
$(env.COMPUTERNAME). So, you can get rid of the commandline addition to
light.exe and change your wxs file like this:

<WixProperty Id="BuildMachine" Value="$(env.COMPUTERNAME)"/>

-Blair

-----Original Message-----
From: Graeme English [mailto:graeme.engl...@hotmail.co.uk] 
Sent: Monday, September 14, 2009 1:13 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Access to variables in localization strings

I'm trying to replace a variable within a localization string however it
always appears blank. I've been using Light -dBuildMachine=abc. Anyone know
if this should work?

e.g.

<WixLocalization Culture="en-us"
xmlns="http://schemas.microsoft.com/wix/2006/localization";>

<String Id="WelcomeDlgDescription3" Overridable="yes">This build was
prepared on [BuildMachine]</String>

Cheers,

Graeme
----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus
on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to