1

Using wix 3.10.2.

I would like to reference an environment variable within a .wixproj file.

I have tried (exerpt from my .wixproj):

<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <JavaDocsBaseDir>$(env.JAVADOCS)</JavaDocsBaseDir>

but I am getting the error:

error MSB4184: The expression """.JAVADOCS" cannot be evaluated. Method 'System.String.JAVADOCS' not found.

Tried removing the "env." with no luck. Also tried using the windows env var format %JAVADOCS%, also with no luck. What am I doing wrong?

I am calling the build via

msbuild ClientSetup.sln /p:Configuration=Release

So, I have the ability to pass the data via commandline as well, if that is an option.

Jon
  • 1,675
  • 26
  • 57

2 Answers2

2

The syntax $(env.JAVADOCS) or %JAVADOCS% is for use in the wix source (.wxs/.wxi) files. For the project you should use normal MSBuild syntax, not Wix syntax. Try $(JAVADOCS)

Nikolay
  • 10,752
  • 2
  • 23
  • 51
  • This ended up working. I was sure I had tried it but it failed to work. Set the env var from a batch file and kicked off the build, but I was getting that error. Tried it again after some more fiddling and it worked. Maybe I hadn't saved something earlier. – Jon Apr 25 '16 at 16:19
1

You should use $(JAVADOCS).

Take a look at Microsoft documentation: https://msdn.microsoft.com/en-us/library/ms171459.aspx

Arkady Sitnitsky
  • 1,846
  • 11
  • 22