使用CustomizableOutDir时,TFS团队构建无法正确启动MSTest.exe时遇到问题。

TFSBuild.rsp

/verbosity:diagnostic
/p:CustomizableOutDir=true

TFSBuild.proj(构建代码段的解决方案)
    <!-- code -->
    <SolutionToBuild Include="$(BuildProjectFolderPath)/../../foo.csproj">
      <Properties>OutputPath=$(BinariesRoot)\WindowsServices\foo\</Properties>
    </SolutionToBuild>
    <!-- tests -->
    <SolutionToBuild Include="$(BuildProjectFolderPath)/../../test/test.sln">
      <Targets>t1;t2</Targets>
      <Properties>OutputPath=$(BinariesRoot)\TestHarness\</Properties>
    </SolutionToBuild>

使用<Properties>OutputPath=$(BinariesRoot)\TestHarness\</Properties><Properties></Properties>,在构建结束时出现以下错误:



找到this article之后,我然后添加了以下内容:
  <Target Name="AfterCompile">
    <ItemGroup>
      <SolutionOutputs Condition="'%(CompilationOutputs.Solution)' == '$(Solution)'" Include="%(RootDir)%(Directory)**\*.*" />
      <ServiceOutputs Include="$(BinariesRoot)\WindowsServices\**\*.*" />
      <TestHarnessOutputs Include="$(BinariesRoot)\TestHarness\*.*" />
    </ItemGroup>
    <Copy SourceFiles="@(SolutionOutputs)" DestinationFolder="$(TeamBuildOutDir)" />
    <Copy SourceFiles="@(ServiceOutputs)" DestinationFolder="$(TeamBuildOutDir)"  />
    <Copy SourceFiles="@(TestHarnessOutputs)" DestinationFolder="$(TeamBuildOutDir)"  />
  </Target>

这给了:



DestinationDirectory不是http://schemas.microsoft.com/developer/msbuild/2003模式的一部分,但我认为我还是会尝试的。因此,我将复制任务上的所有DestinationFolder更改为DestinationDirectory,并按预期得到了以下信息:



外面有人可以将CustomizableOutDir和MSTest与他们的TFS团队 build 融为一体吗?

编辑:

我找到了this discussion并应用了此更改:
<Target Name="BeforeTest">
  <!-- The tests won't run if the binaries directory does not exist -->
  <MakeDir
    Directories="$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)"
    Condition="!Exists('$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)')" />
</Target>

结果是这样的:

最佳答案

这使tfs/mstest/msbuild很高兴。

<Target Name="BeforeTest">
  <!-- The tests won't run if the binaries directory does not exist -->
  <MakeDir
    Directories="$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)"
    Condition="!Exists('$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)')" />
</Target>

没有获得任何测试结果是部署和测试箱配置的另一个问题。

关于tfs - CustomizableOutDir = true在团队建立过程中破坏了MSTest.exe,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1603024/

10-13 05:19