[英]How to disable unit tests in Release mode under TFS
I want to setup the TFS to build both Debug and Release versions of my solutions but only run the unit tests when in Debug mode. 我想设置TFS来构建我的解决方案的Debug和Release版本,但只在Debug模式下运行单元测试。 I've tried disabling the builds for the test projects in my solutions' Configuration Properties, but to no avail. 我尝试在我的解决方案的配置属性中禁用测试项目的构建,但无济于事。 And what's annoying is that the tests will always fail in Release mode because it can't seem to find the files even though they exist... 令人讨厌的是,测试将始终在发布模式下失败,因为即使它们存在,它似乎也无法找到文件...
So anyone know how to get TFS to run the unit tests only in Debug mode (but still build both Debug and Release modes)? 所以任何人都知道如何让TFS仅在调试模式下运行单元测试(但仍构建调试和发布模式)?
In VS2010: 在VS2010中:
Team Explorer
→ Project
→ Builds
→ In your " Build Definition " select Edit Build Definition
→ Process
Team Explorer
→ Project
→ Builds
→在“ 构建定义 ”中选择“ Edit Build Definition
→“ Process
Here you should configure: 在这里你应该配置:
I've finally found out how to do it. 我终于找到了如何做到这一点。 In the TFS build definition file (.proj), under the section for listing out the test list/DLLs, just add a $(Configuration) condition to each item as follows:- 在TFS构建定义文件(.proj)中,在列出测试列表/ DLL的部分下,只需为每个项添加$(配置)条件,如下所示: -
<ItemGroup>
<MetaDataFile Condition="'$(Configuration)'=='Debug'" Include="$(BuildProjectFolderPath)/SubFolders/MyTestListFile.vsmdi">
<TestList>My Test List Name</TestList>
</MetaDataFile>
<TestContainer Condition="'$(Configuration)'=='Debug'" Include="$(OutDir)\MyTests.dll" />
</ItemGroup>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.