1

I need to use the built-in variable [ComputerName] in a property in a Transforms.xml WiX file.

What I'm doing: <Property Id="MYCOMPUTERNAME" VALUE="[ComputerName]" />

What shows up is: "[ComputerName]"

That's not what I want.

I want the real computer name made available to the Property "MYCOMPUTERNAME".

Has anyone tried this successfully and how? Thank you.

werp
  • 80
  • 8

1 Answers1

0

WiX has a way to access environment variables. Check out the tutorial:

http://wix.tramontana.co.hu/tutorial/com-expression-syntax-miscellanea/expression-syntax

I think the syntax you would use is this, but I haven't tested it.

Pat O'Shea
  • 50
  • 1
  • 8
  • I appreciate the link, but it didn't work. I tried setting the value to "$(env.ComputerName)" and to "%COMPUTERNAME". In either case, I get a literal value ($(env.ComputerName) or %COMPUTERNAME) placed in the variable. – werp May 17 '13 at 21:23
  • [This](http://stackoverflow.com/questions/3459998/get-an-environment-variable-into-a-wix-property) is what you want. You need to use the element. [Here's] (http://wix.sourceforge.net/manual-wix3/wix_xsd_setproperty.htm) the documentation reference. – Pat O'Shea May 18 '13 at 03:44
  • Thank you, but I get an **"MsiTransform -- FAILED"** error when making use of `` in the Transforms.xml file. I used `Sequence="execute"` and `Before="InstallInitialization"` inside the tag. When I remove the `` tag, it compiles well. – werp May 20 '13 at 15:35