问题描述
关注了几篇博客,详细介绍了如何使xUnit与Team Services Build vNext一起使用:
After following several blogs detailing how to get xUnit working with Team Services Build vNext:
在使用xUnit适配器的TFS/VSO Build vNext
http://www.donovanbrown.com/post/2015/06/15/how-to-run-xunit-test-with-vnext-build
没有一个对我有用.通过检查构建日志,我得到了每个测试程序集的以下警告.
None of which worked for me. From examining the build logs I get the following warnings for each of my test assemblies.
--------------------
Warning: [xUnit.net 00:00:00.1644156] Exception discovering tests from CHO.SAM.Business.Test: System.BadImageFormatException:
Could not load file or assembly 'c:\_Work\473cef3c\CHO\CHO.ALL\Tests\CHO.SAM.Business.Test\CHO.SAM.Business.Test\bin\Debug\xunit.execution.desktop.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
--------------------
以前有人看过吗?如果是这样,您是否找到了解决方案?
Has anyone seen this before? and if so did you figure out a solution?
我的想法是;我的测试项目是使用.NET Framework 4.6编译的,我想知道这是否可能引起问题?如果是这样,我将不得不移至nUnit之类,因为我认为仅使用一个测试框架就更改编译是正确的.
My thoughts are; my test projects are compiled using .NET Framework 4.6, I was wondering if this could be causing the problem? If so I would have to move over to nUnit or something as I don't feel it's right to change the compilation just to use a single test framework.
推荐答案
- 将"/Framework:Framework45"添加到高级/其他控制台选项"(在.NET 4.5下运行)
或 - 将"/Framework:Framework40"添加到高级/其他控制台选项"(在.NET 4.0下运行)
或 - 将高级/VSTest版本"更改为"Visual Studio 2013"(在.NET 3.5下运行)
- Add "/Framework:Framework45" to "Advanced/Other console options" (to run under .NET 4.5)
or - Add "/Framework:Framework40" to "Advanced/Other console options" (to run under .NET 4.0)
or - Change "Advanced/VSTest version" to "Visual Studio 2013" (to run under .NET 3.5)
这篇关于Xunit无法使用Visual Studio Team Services Build VNext工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!