1
votes

Using WIX I cannot seem to get my variables to work - any ideas?

I'm using: WIX version 3.5 and Visual Studio 2010

Here is the error I am getting ( This is the output from visual studio ):

------ Build started: Project: InstallProject, Configuration: Debug x86 ------ "C:\Program Files\Windows Installer XML v3.5\bin\heat.exe" dir "c:\publish\ems" -cg EMSPublishedFiles -gg -scom -sreg -sfrag -srd -dr INSTALLLOCATION -var env.EMS_PUBLISHDIR -out "C:\Projects\ems\Trunk\Code\Installer\InstallProject\Fragments\FilesFragment.wxs" Microsoft (R) Windows Installer Xml Toolset Harvester version 3.5.2519.0 Copyright (C) Microsoft Corporation. All rights reserved.

C:\Program Files\Windows Installer XML v3.5\bin\candle.exe -dEMS_PUBLISHDIR=c:\publish\ems -dDebug -d"DevEnvDir=C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\" -dSolutionDir=C:\Projects\ems\Trunk\Code\Installer\ -dSolutionExt=.sln -dSolutionFileName=InstallProject.sln -dSolutionName=InstallProject -dSolutionPath=C:\Projects\ems\Trunk\Code\Installer\InstallProject.sln -dConfiguration=Debug -dOutDir=Packages\ -dPlatform=x86 -dProjectDir=C:\Projects\ems\Trunk\Code\Installer\InstallProject\ -dProjectExt=.wixproj -dProjectFileName=InstallProject.wixproj -dProjectName=InstallProject -dProjectPath=C:\Projects\ems\Trunk\Code\Installer\InstallProject\InstallProject.wixproj -dTargetDir=C:\Projects\ems\Trunk\Code\Installer\InstallProject\Packages\ -dTargetExt=.msi -dTargetFileName=EMSSetup.msi -dTargetName=EMSSetup -dTargetPath=C:\Projects\ems\Trunk\Code\Installer\InstallProject\Packages\EMSSetup.msi -out obj\Debug\Fragments\ -arch x86 -ext "C:\Program Files\Windows Installer XML v3.5\bin\WixUtilExtension.dll" -ext "C:\Program Files\Windows Installer XML v3.5\bin\WixUIExtension.dll" -ext "C:\Program Files\Windows Installer XML v3.5\bin\WixSqlExtension.dll" -ext "C:\Program Files\Windows Installer XML v3.5\bin\WixIIsExtension.dll" Fragments\FilesFragment.wxs

C:\Projects\ems\Trunk\Code\Installer\InstallProject\Fragments\FilesFragment.wxs(6,0): error CNDL0150: Undefined preprocessor variable '$(env.EMS_PUBLISHDIR)'.

Its also worth noting that even though I have defined variables in Visual studios project properties : Proceessor variables ( EMS_PUBLISHDIR=c:\publish\ems; ) if I put the variable name in the project prebuild event $(EMS_PUBLISHDIR) I get an empty string. I checked the project file directory using notepad and the declations for debug / release etc all look ok.

Any ideas?

3

3 Answers

1
votes

Are you sure that this is being run from Visual Studio? I see a call to candle, which I don't see in my runs from within Votive. I had a similar issue which was caused when building the installer using a build server. The variable was lost in the additional layer. 1) At the build server level 2) At the MSBuild level 3) What was recognized by the wixproj.

1
votes

You're looking for an environment variable, rather than a WiX variable.

$(env.EMS_PUBLISHDIR) - Looks for the Environment variable EMS_PUBLISHDIR $(var.EMS_PUBLISHDIR) - Looks for the variable defined via WiX

0
votes

If you define -dEMS_PUBLISHDIR=... in candle call it becomes $(var.EMS_PUBLISHDIR) within Wix, not $(env.EMS_PUBLISHDIR).