title: WiX project that references an SSDT project fails to build in TFSBuild - Undefined preprocessor variable '$(var.DatabaseProject.TargetDir)'
body: <p>My project which is part of a larger solution was converted from a dbproj to asqlproj (SSDT). The solution includes a WiX installer which references the SSDT project. The WiX project builds fine on multiple developer systems through VS2010. The automated builds that we've always used, however, are failing with this error:</p>
  
  <pre><code>error CNDL0150: Undefined preprocessor variable '$(var.DatabaseProject.TargetDir)'.
  </code></pre>
  
  <p>The solution has been built by TFS automated builds for many months without issue prior to this project being converted. I can see from the build log that the SSDT project is being built, here are some relevant lines from the build log:</p>
  
  <pre><code>Project "C:\B\1\SourcePath\Server\Server.wixproj" (8) is building "C:\B\1\SourcePath\Database\DatabaseProject.sqlproj" (12) on node 1 (default targets).
  ...
  Done Building Project "C:\B\1\SourcePath\Database\DatabaseProject.sqlproj" (default targets).
  </code></pre>
  
  <p>I can also see that the .dacpac and .dll files for the database project are created and copied into the output directory that TFS build has redirected the projects to.</p>
  
  <p>The reference to the database project seems fine and TFS build seems to know that it should be built, but WiX is complaining about the undefined preprocessor variable for TargetDir.</p>
  
  <p>I must be missing something...Is the output redirect employed by TFS causing my issue? I'm not sure where to go from here and appreciate any help you can suggest.</p>
  
  <p><strong>MORE INFO</strong></p>
  
  <p>Looking at the log file for the build in more detail I can see that the parameters for the <code>.sqlproj</code> project aren't being passed on the command line to <code>candle.exe</code>. When I build locally in VS2010, I can see the expected parameters passed as follows (just like the other projects referenced by the WiX project):</p>
  
  <pre><code>-d"DatabaseProject.FullConfiguration=Release|AnyCPU"
  -dDatabaseProject.Platform=AnyCPU
  -dDatabaseProject.ProjectDir=C:\SourcePath\Database\
  -dDatabaseProject.ProjectExt=.sqlproj
  -dDatabaseProject.ProjectFileName=DatabaseProject.sqlproj
  -dDatabaseProject.ProjectName=DatabaseProject
  -dDatabaseProject.ProjectPath=C:\SourcePath\Database\DatabaseProject.sqlproj
  -dDatabaseProject.TargetDir=C:\SourcePath\Database\sql\release\
  -dDatabaseProject.TargetExt=.dll
  -dDatabaseProject.TargetFileName=DatabaseProject.dll
  -dDatabaseProject.TargetName=DatabaseProject
  -dDatabaseProject.TargetPath=C:\SourcePath\Database\sql\release\DatabaseProject.dll
  </code></pre>
  
  <p>None of these parameters are being passed to <code>candle.exe</code> during the TFS build. I figured this information might be useful for helping answer the question.</p>
  
  <p>Any help is greatly appreciated!</p>