unit-testing - 在哪里放置 'useLegacyV2RuntimeActivationPolicy' 以在 TFS2012 中构建

标签 unit-testing tfsbuild

虽然我在本地在单元测试中遇到错误:

Mixed mode assembly is built against version 'v2.0.50727' of 
the runtime and cannot be loaded in the 4.0 runtime without 
additional configuration information

解决方案是添加
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0"/>
   </startup>
</configuration>

到位于的配置文件
c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE
\CommonExtensions\Microsoft\TestWindow\vstest.executionengine.x86.exe.config

这在我们的 TFS2012 构建服务器上仍然出错。我也在TFS2012上的文件中添加了启动标签,但是构建服务器报错。

我如何让它在构建定义中用于单元测试项目(使用 VS2012 和 TFS2012 的新单元测试框架)?

最佳答案

虽然在 TFS 上运行也有问题,但您可以尝试以编程方式设置它(例如使用 this approach )。虽然我不建议在生产代码中使用它,但对于 UnitTests 来说应该已经足够了。

关于unit-testing - 在哪里放置 'useLegacyV2RuntimeActivationPolicy' 以在 TFS2012 中构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13052374/

相关文章:

unit-testing - 使用CakePHP的集成测试用例如何测试异常?

unit-testing - 如何对调用子级方法的父级 react 组件进行单元测试

visual-studio - 获取要复制到 TFS Build Drop 位置的静态内容

c++ - MSbuild 错误 : The builds tools for v140 (Platform Toolset = 'v140' ) cannot be found

java - 无法找到或加载主类 org.testng.TestNG

python - 如何在 Python 单元测试中模拟文件系统?

eclipse - 在GGTS(Eclipse)中运行时,为什么Grails 3单元测试会引发StackOverflowError?

azure-devops - TFS 2015 内部版本 : NuGet restore from an internal repository

tfs - TFS 2010-复制期间发生错误:路径太长

powershell - TFS 2013 默认模板运行 powershell 脚本和日志输出