Xunit not working using Visual Studio Team Services Build VNext

℡╲_俬逩灬. 提交于 2019-12-06 12:42:40
  • 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)

This error is normally caused by a x64 compiled assembly running on x86 test runner or vice versa. Check the solution build configuration that is being run.

Daniel Auger

I had this same issue. Adding a UI test did not fix it for me. I found two alternatives that work:

  1. use .net 4.5

    OR

  2. Set the advanced options of the VSTest task to use 2013 instead of 2015.

Hopefully this will be fixed soon.

In the end, I added a Visual Studio Coded UI test project and removed all it's contents (a class), it's empty!

I'm assuming it's added a reference or something that the build server felt it needed.

I am now getting my unit tests discovered, running and with code coverage.

Wierd!

It works, but I don't know why...

I ran into this issue when using a .Net Core class library to run my xUnit tests against a .Net Core Web Project (.Net Framework). What solved the issue for me was to change the default processor for running test to X64 in VS2015 via:

Menu Bar -> Test -> Test Settings -> Default Processor Architecture -> X64

This solution was posted by @RehanSaeed here https://github.com/dotnet/cli/issues/3103

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!