Question

In a .NET project I am using XUnit to write and run my unit tests. Locally, everything works fine. But when I try to run the tests using Jenkins it fails.

The error message is:

Test:
  xUnit.net MSBuild runner (64-bit .NET 4.0.30319.1)
  xunit.dll:     Version 1.9.1.1600
  Test assembly: <http://…/Foo.Tests.dll>

Unhandled Exception: System.IO.FileLoadException: Could not load file or
assembly 'xunit.extensions, Version=1.6.1.1521, Culture=neutral,
PublicKeyToken=8d05b1bb7a6fdb6c' or one of its dependencies. The located
assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)

What's strange is that the requested version (1.6.1.1521) is nowhere used, neither in app.config nor in packages.config nor in the directly linked assemblies.

My guess is that something with NuGet (we use the Allow NuGet to download missing packages option) is wrong, but at least there is no obvious failure.

Any idea of what the problem might be, or how we could get a better feeling of where to search?

Was it helpful?

Solution

Solved it: the app.config file with the assembly binding redirects was in the wrong project …

OTHER TIPS

I was getting the same error message.

Project A was referencing a different version of xunit than Project B and Project A was using an attribute from Project B. Upgrading Project B's version of xunit resolved the issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top