CustomizedOutDir=true 在 Team Build 期间破坏 MSTest.exe
使用 CustomizedOutDir 时,我在 TFS Team Build 正确启动 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>
同时具有
和
,我在构建结束时收到以下错误:
“C:\build\BuildType\TFSBuild.proj” (测试配置目标) (1:12) -> (CoreTestConfiguration 目标)->
MSBUILD:警告 MSB6003: 指定任务可执行文件“MSTest.exe” 无法运行。目录名称 无效
< /a>,然后我添加了以下内容:
<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>
给出了以下内容:
(编译后目标)->
C:\build\BuildType\TFSBuild.proj(289,5): 错误 MSB3023:无目的地 指定用于复制。请提供 “目标文件”或 “目标目录”。
DestinationDirectory 不是架构 http://schemas.microsoft.com/developer/msbuild/2003
的一部分,但我想无论如何我都会尝试一下。因此,我将复制任务上的所有 DestinationFolder
更改为 DestinationDirectory
,正如预期的那样,我得到了以下结果:
(编译后目标)->
C:\build\BuildType\TFSBuild.proj(288,44): 错误 MSB4064: “DestinationDirectory”参数是 “复制”任务不支持。 验证该参数是否存在 任务,并且它是一个可设置的公共 实例属性。
C:\build\BuildType\TFSBuild.proj(288,5): 错误 MSB4063:“复制”任务可能 不使用其输入进行初始化 参数。
有人让 CustomizedOutDir 和 MSTest 与他们的 TFS Team Build 协调工作吗?
编辑:
<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>
这导致了:
“C:\build\BuildType\TFSBuild.proj” (运行测试目标) (1:11) -> “C:\build\BuildType\TFSBuild.proj” (测试配置目标) (1:12) -> (CoreTestConfiguration 目标)->
MSBUILD:警告 MSB6006: “MSTest.exe”退出,代码为 1。
When using CustomizableOutDir, I'm having problems with TFS Team Build firing off MSTest.exe properly.
TFSBuild.rsp
/verbosity:diagnostic
/p:CustomizableOutDir=true
TFSBuild.proj (solutions to build snippet)
<!-- 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>
With both <Properties>OutputPath=$(BinariesRoot)\TestHarness\</Properties>
and <Properties></Properties>
, I get the following error at the end of the build:
"C:\build\BuildType\TFSBuild.proj"
(TestConfiguration target) (1:12) ->
(CoreTestConfiguration target) ->
MSBUILD : warning MSB6003: The
specified task executable "MSTest.exe"
could not be run. The directory name
is invalid
After finding this article, I and then added the following:
<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>
Which gave this:
(AfterCompile target) ->
C:\build\BuildType\TFSBuild.proj(289,5):
error MSB3023: No destination
specified for Copy. Please supply
either "DestinationFiles" or
"DestinationDirectory".
DestinationDirectory is not part of the schema http://schemas.microsoft.com/developer/msbuild/2003
, but I figured I would try it anyway. So I changed all the DestinationFolder
on the copy tasks to DestinationDirectory
and as expected I got this:
(AfterCompile target) ->
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.
C:\build\BuildType\TFSBuild.proj(288,5):
error MSB4063: The "Copy" task could
not be initialized with its input
parameters.
Anybody out there have CustomizableOutDir and MSTest working together in harmony with their TFS Team Build?
EDIT:
I found this discussion and applied this change:
<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>
Which resulted in this:
"C:\build\BuildType\TFSBuild.proj"
(RunTest target) (1:11) ->
"C:\build\BuildType\TFSBuild.proj"
(TestConfiguration target) (1:12) ->
(CoreTestConfiguration target) ->
MSBUILD : warning MSB6006:
"MSTest.exe" exited with code 1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这让 tfs/mstest/msbuild 很高兴。
没有得到任何测试结果是部署和测试盒配置的另一个问题。
This made tfs/mstest/msbuild happy.
Not getting any test results was a different problem with the deployment and test box configuration.