Question

This WiX Setup project compiles in Visual Studio without a problem.

However, running it in NAnt using the msbuild task shows the following error.

Heat Prebuild event:

"$(SolutionDir)\App_Tools\WiX Toolset v3.8\bin\heat.exe" dir "$(SolutionDir)\App_Shell \bin\$(ConfigurationName)" -dr "AppDirectory" -cg "AppComponentGroup" -t   "$(ProjectDir)Filter.xslt" -gg -g1 -sf -srd -sreg -var "var.AppAppPath" -out   "$(ProjectDir)\App_HarvestedHeatFile.wxs"  

msbuild task:

<msbuild project="App_Installers\App.Setup\App.Setup.wixproj">
        <property name="Configuration" value="Release"/>
        <property name="target" value="Rebuild"/>
        <property name="verbosity" value="Normal"/>
</msbuild>

Error message Prebuild:

  [msbuild] Build started 03.02.2014 15:38:35.
  [msbuild] Project "E:\Projects\Company\App\Development\trunk\src\App_Inst
allers\App.Setup\App.Setup.wixproj" on node 1 (default targets).
  [msbuild] AssignCultures:
  [msbuild]   Culture: en-US
  [msbuild]   Culture: de-DE
  [msbuild] PreBuildEvent:
  [msbuild]   "*Undefined if not building a solution or within Visual Studio*\App_Tools\WiX Toolset v3.8\bin\heat.exe" dir "*Undefined if not building a soluti
on or within Visual Studio*\App_Shell\bin\Release" -dr "AppDirectory" -cg "AppComponentGroup" -t "E:\Projects\Company\App\Development\trunk\src\App_Inst
allers\App.Setup\Filter.xslt" -gg -g1 -sf -srd -sreg -var "var.AppAppPath" -ou
t "E:\Projects\Company\App\Development\trunk\src\App_Installers\App.Setup\
\App_HarvestedHeatFile.wxs"
  [msbuild]   The system cannot find the path specified.
  [msbuild] C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix2010.targets(81
6,5): error MSB3073: The command ""*Undefined if not building a solution or with
in Visual Studio*\App_Tools\WiX Toolset v3.8\bin\heat.exe" dir "*Undefined if n
ot building a solution or within Visual Studio*\App_Shell\bin\Release" -dr "AppDirectory" -cg "AppComponentGroup" -t "E:\Projects\Company\App\Development
\trunk\src\App_Installers\App.Setup\Filter.xslt" -gg -g1 -sf -srd -sreg -var "
var.AppAppPath" -out "E:\Projects\Company\App\Development\trunk\src\App_In
stallers\App.Setup\\App_HarvestedHeatFile.wxs"" exited with code 3. [E:\Projec
ts\Company\App\Development\trunk\src\App_Installers\App.Setup\App.Setup.w
ixproj]
  [msbuild] Done Building Project "E:\Projects\Company\App\Development\trunk
\src\App_Installers\App.Setup\App.Setup.wixproj" (default targets) -- FAILED.

  [msbuild]
  [msbuild] Build FAILED.
  [msbuild]
  [msbuild] "E:\Projects\Company\App\Development\trunk\src\App_Installers\R
oCo.Setup\App.Setup.wixproj" (default target) (1) ->
  [msbuild] (PreBuildEvent target) ->
  [msbuild]   C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix2010.targets(
816,5): error MSB3073: The command ""*Undefined if not building a solution or wi
thin Visual Studio*\App_Tools\WiX Toolset v3.8\bin\heat.exe" dir "*Undefined if
 not building a solution or within Visual Studio*\App_Shell\bin\Release" -dr "R
oCoDirectory" -cg "AppComponentGroup" -t "E:\Projects\Company\App\Developme
nt\trunk\src\App_Installers\App.Setup\Filter.xslt" -gg -g1 -sf -srd -sreg -var
 "var.AppAppPath" -out "E:\Projects\Company\App\Development\trunk\src\App_
Installers\App.Setup\\App_HarvestedHeatFile.wxs"" exited with code 3. [E:\Proj
ects\Company\App\Development\trunk\src\App_Installers\App.Setup\App.Setup
.wixproj]
  [msbuild]
  [msbuild]     0 Warning(s)
  [msbuild]     1 Error(s)
  [msbuild]
  [msbuild] Time Elapsed 00:00:00.10

BUILD FAILED
Was it helpful?

Solution

In your case, the issue is with the $(SolutionDir) property and not your pre-processor. The issue is that the property $(SolutionDir) is not getting defined and thats why the error. MSBuild does not define the SolutionDir property so you'll need to manually specify it:

msbuild.exe /p:SolutionDir=

Did the pre-processor variable (AppAppPath) get evaluated properly using VS? I was thinking that you need to do something like this to get the right value: http://www.ageektrapped.com/blog/setting-properties-for-wix-in-msbuild/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top