title: CustomizableOutDir=true breaks MSTest.exe during Team Build
body: <p>When using CustomizableOutDir, I'm having problems with TFS Team Build firing off MSTest.exe properly.</p>
  
  <p>TFSBuild.rsp</p>
  
  <pre><code>/verbosity:diagnostic
  /p:CustomizableOutDir=true
  </code></pre>
  
  <p>TFSBuild.proj (solutions to build snippet)</p>
  
  <pre><code>    &lt;!-- code --&gt;
      &lt;SolutionToBuild Include="$(BuildProjectFolderPath)/../../foo.csproj"&gt;
        &lt;Properties&gt;OutputPath=$(BinariesRoot)\WindowsServices\foo\&lt;/Properties&gt;
      &lt;/SolutionToBuild&gt;
      &lt;!-- tests --&gt;
      &lt;SolutionToBuild Include="$(BuildProjectFolderPath)/../../test/test.sln"&gt;
        &lt;Targets&gt;t1;t2&lt;/Targets&gt;
        &lt;Properties&gt;OutputPath=$(BinariesRoot)\TestHarness\&lt;/Properties&gt;
      &lt;/SolutionToBuild&gt;
  </code></pre>
  
  <p>With both <code>&lt;Properties&gt;OutputPath=$(BinariesRoot)\TestHarness\&lt;/Properties&gt;</code> and <code>&lt;Properties&gt;&lt;/Properties&gt;</code>, I get the following error at the end of the build:</p>
  
  <blockquote>
    <p>"C:\build\BuildType\TFSBuild.proj"
    (TestConfiguration target) (1:12) ->
    (CoreTestConfiguration target) -><br>
    MSBUILD : warning MSB6003: The
    specified task executable "MSTest.exe"
    could not be run. The directory name
    is invalid</p>
  </blockquote>
  
  <p>After finding <a href="http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/8ea0d57f-97ac-43a5-b265-09632a12a138" rel="noreferrer">this article</a>, I and then added the following:</p>
  
  <pre><code>  &lt;Target Name="AfterCompile"&gt;
      &lt;ItemGroup&gt;
        &lt;SolutionOutputs Condition="'%(CompilationOutputs.Solution)' == '$(Solution)'" Include="%(RootDir)%(Directory)**\*.*" /&gt;
        &lt;ServiceOutputs Include="$(BinariesRoot)\WindowsServices\**\*.*" /&gt;
        &lt;TestHarnessOutputs Include="$(BinariesRoot)\TestHarness\*.*" /&gt;
      &lt;/ItemGroup&gt;
      &lt;Copy SourceFiles="@(SolutionOutputs)" DestinationFolder="$(TeamBuildOutDir)" /&gt;
      &lt;Copy SourceFiles="@(ServiceOutputs)" DestinationFolder="$(TeamBuildOutDir)"  /&gt;
      &lt;Copy SourceFiles="@(TestHarnessOutputs)" DestinationFolder="$(TeamBuildOutDir)"  /&gt;
    &lt;/Target&gt;
  </code></pre>
  
  <p>Which gave this:</p>
  
  <blockquote>
    <p>(AfterCompile target) -><br>
    C:\build\BuildType\TFSBuild.proj(289,5):
    error MSB3023: No destination
    specified for Copy. Please supply
    either "DestinationFiles" or
    "DestinationDirectory".</p>
  </blockquote>
  
  <p>DestinationDirectory is not part of the schema <code>http://schemas.microsoft.com/developer/msbuild/2003</code>, but I figured I would try it anyway.  So I changed all the <code>DestinationFolder</code> on the copy tasks to <code>DestinationDirectory</code> and as expected I got this:</p>
  
  <blockquote>
    <p>(AfterCompile target) -><br>
    C:\build\BuildType\TFSBuild.proj(288,44):
    error MSB4064: The
    "DestinationDirectory" parameter is
    not supported by the "Copy" task.
    Verify the parameter exists on the
    task, and it is a settable public
    instance property.<br>
    C:\build\BuildType\TFSBuild.proj(288,5):
    error MSB4063: The "Copy" task could
    not be initialized with its input
    parameters.</p>
  </blockquote>
  
  <p>Anybody out there have CustomizableOutDir and MSTest working together in harmony with their TFS Team Build?</p>
  
  <p>EDIT:</p>
  
  <p>I found <a href="http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/6ced3395-6c8d-4f49-93db-80c49ad1cad9" rel="noreferrer">this discussion</a> and applied this change:</p>
  
  <pre><code>&lt;Target Name="BeforeTest"&gt;
    &lt;!-- The tests won't run if the binaries directory does not exist --&gt;
    &lt;MakeDir
      Directories="$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)"
      Condition="!Exists('$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)')" /&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>Which resulted in this:</p>
  
  <blockquote>
    <p>"C:\build\BuildType\TFSBuild.proj"
    (RunTest target) (1:11) ->
    "C:\build\BuildType\TFSBuild.proj"
    (TestConfiguration target) (1:12) ->
    (CoreTestConfiguration target) -><br>
    MSBUILD : warning MSB6006:
    "MSTest.exe" exited with code 1.</p>
  </blockquote>