1

In by bundle.wxs I am trying to set a custom variable which is base on the configuration being built like this:

<Variable Name="SETTINGPROVIDERURL" Value="$(var.siteloc)"/>

I am trying to set "siteloc" on the Properties > build tab in the VS2017 project. I am trying both preprocessor and wixvariable to get at least one to come through. Visual Studio wix bootstrap Project properties build tab

in the wixproj file, I can see these:

 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
    <WixVariables>siteloc=bar;</WixVariables>
    <DefineConstants>siteloc=foo;</DefineConstants>
  </PropertyGroup>

When I build, I get CNDL0150: Undefined preprocessor variable '$(var.siteloc)'. As you can see, my variable (either one) was not added as a parameter to candle in the VS Console:

2>------ Build started: Project: KioskHostBootstrapper, Configuration: Release x86 ------
2>  C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe -dBuildVersion=5.0.307.1 -d"DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\\" -dSolutionDir=C:\centrics\CentricsStoreFront_5_0\Source\ -dSolutionExt=.sln -dSolutionFileName=CentricsStoreFront_5_0.sln -dSolutionName=CentricsStoreFront_5_0 -dSolutionPath=C:\centrics\CentricsStoreFront_5_0\Source\CentricsStoreFront_5_0.sln -dConfiguration=Release -dOutDir=bin\Release\ -dPlatform=x86 -dProjectDir=C:\centrics\CentricsStoreFront_5_0\Source\StoreFrontUtilities\KioskHost\WiXInstaller\KioskHostBootstrapper\ -dProjectExt=.wixproj -dProjectFileName=KioskHostBootstrapper.wixproj -dProjectName=KioskHostBootstrapper -dProjectPath=C:\centrics\CentricsStoreFront_5_0\Source\StoreFrontUtilities\KioskHost\WiXInstaller\KioskHostBootstrapper\KioskHostBootstrapper.wixproj -dTargetDir=C:\centrics\CentricsStoreFront_5_0\Source\StoreFrontUtilities\KioskHost\WiXInstaller\KioskHostBootstrapper\bin\Release\ -dTargetExt=.exe -dTargetFileName=KioskHostSetup.exe -dTargetName=KioskHostSetup -dTargetPath=C:\centrics\CentricsStoreFront_5_0\Source\StoreFrontUtilities\KioskHost\WiXInstaller\KioskHostBootstrapper\bin\Release\KioskHostSetup.exe -dKioskHostInstaller.Configuration=Release -d"KioskHostInstaller.FullConfiguration=Release|x86" -dKioskHostInstaller.Platform=x86 -dKioskHostInstaller.ProjectDir=C:\centrics\CentricsStoreFront_5_0\Source\StoreFrontUtilities\KioskHost\WiXInstaller\KioskHostInstaller\ -dKioskHostInstaller.ProjectExt=.wixproj -dKioskHostInstaller.ProjectFileName=KioskHostInstaller.wixproj -dKioskHostInstaller.ProjectName=KioskHostInstaller -dKioskHostInstaller.ProjectPath=C:\centrics\CentricsStoreFront_5_0\Source\StoreFrontUtilities\KioskHost\WiXInstaller\KioskHostInstaller\KioskHostInstaller.wixproj -dKioskHostInstaller.TargetDir=C:\centrics\CentricsStoreFront_5_0\Source\StoreFrontUtilities\KioskHost\WiXInstaller\KioskHostInstaller\bin\Release\ -dKioskHostInstaller.TargetExt=.msi -dKioskHostInstaller.TargetFileName=KioskHostInstaller.msi -dKioskHostInstaller.TargetName=KioskHostInstaller -dKioskHostInstaller.TargetPath=C:\centrics\CentricsStoreFront_5_0\Source\StoreFrontUtilities\KioskHost\WiXInstaller\KioskHostInstaller\bin\Release\KioskHostInstaller.msi -out obj\Release\ -arch x86 -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUtilExtension.dll" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixBalExtension.dll" Bundle.wxs
2>C:\centrics\CentricsStoreFront_5_0\Source\StoreFrontUtilities\KioskHost\WiXInstaller\KioskHostBootstrapper\Bundle.wxs(20,0): error CNDL0150: Undefined preprocessor variable '$(var.siteloc)'.
2>Done building project "KioskHostBootstrapper.wixproj" -- FAILED.

I tried this SF Suggestion,

 <PropertyGroup>
    <siteloc>fubar</siteloc>
 </PropertyGroup>

but it didn't work.

What am I missing?

ToddK
  • 765
  • 9
  • 16
  • 1
    Do you have somewhere else in your wixproj redefining DefineConstants? Do you import a props/proj/targets file after the wixproj snippet you put in the question that may redefine it? Visual Studio annoyingly caches proj files and imported projects; Have you tried restarting visual studio and rebuilding? If you define `` in your wixProj Do you only see the text "DefineConstants: " in your output? – Brian Sutherland Mar 28 '18 at 17:31
  • I guess the target should be "BeforeBuild" since the build doesn't complete :) – Brian Sutherland Mar 28 '18 at 17:33
  • 1
    Bingo! A while back I added in the target BeforeBuild to get the assembly version of the app I'm making the install for, adn then set it using DefineConstants. Will get that a different way (just found this https://stackoverflow.com/a/641094/232226) Add your comment as the answer, and I'll mark it – ToddK Mar 28 '18 at 21:07

0 Answers0