xUnit 在 Jenkins 下失败:BadImageFormatException
xUnit fails under Jenkins: BadImageFormatException
Jenkins 下的 xUnit 测试 运行。
我 运行 测试 x86/x64 Debug/Release 配置。
在 Jenkins 下 运行ning 时某些配置失败并出现错误。
运行 命令和错误消息如下:
packages\xunit.runner.console.2.1.0\tools\xunit.console.exe bin\x86\Release\MyDllName.dll -verbose -parallel none -diagnostics
xUnit.net Console Runner (64-bit .NET 4.0.30319.42000)
System.BadImageFormatException: Could not load file or assembly 'MyDllName, Version=1.3.549.4300, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
<Absolute-path-to-file>\RunTests.1.proj(59,5): error MSB3073: The command "packages\xunit.runner.console.2.1.0\tools\xunit.console.exe bin\x86\Release\MyDllName.dll -verbose -parallel none -diagnostics" exited with code 1.
当我从命令行 运行 使用与 运行 Jenkins 作业相同的批处理文件时,一切正常。
我尝试 运行 Jenkins 作为服务和独立应用程序。我在这两种情况下都出错了。
我尝试 运行 ILSpy
在此 dll 上,但没有发现有关缺少依赖项的错误消息。
如何在 Jenkins 下的所有配置上 xUnit
运行 成功?
我的 dll 使用 .NET 4.6.1 构建。
Jenkins 版本:2.32.1,但我对旧版本也有同样的问题。
服务器 OS:Windows 2008 R2 企业版。
xunit.runner.console: 2.1.0
这可能是所讨论的 DLL 具有 32 位位约束的结果。
您需要
一个。 运行 32 位 运行ner(例如,如果某些 dep 需要 32 位 DLL)通过使用 dotnet xunit -x86
命令,
或
b。为 AnyCpu [或 x64] 构建测试程序集(但使用 "Prefer 32 bit" 标志)。请记住,该标志仅在 .NET 4.5 中可用,在 4.6 中不可用。
See lots more similar cases in this answer
Jenkins 下的 xUnit 测试 运行。
我 运行 测试 x86/x64 Debug/Release 配置。 在 Jenkins 下 运行ning 时某些配置失败并出现错误。
运行 命令和错误消息如下:
packages\xunit.runner.console.2.1.0\tools\xunit.console.exe bin\x86\Release\MyDllName.dll -verbose -parallel none -diagnostics
xUnit.net Console Runner (64-bit .NET 4.0.30319.42000)
System.BadImageFormatException: Could not load file or assembly 'MyDllName, Version=1.3.549.4300, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
<Absolute-path-to-file>\RunTests.1.proj(59,5): error MSB3073: The command "packages\xunit.runner.console.2.1.0\tools\xunit.console.exe bin\x86\Release\MyDllName.dll -verbose -parallel none -diagnostics" exited with code 1.
当我从命令行 运行 使用与 运行 Jenkins 作业相同的批处理文件时,一切正常。
我尝试 运行 Jenkins 作为服务和独立应用程序。我在这两种情况下都出错了。
我尝试 运行 ILSpy
在此 dll 上,但没有发现有关缺少依赖项的错误消息。
如何在 Jenkins 下的所有配置上 xUnit
运行 成功?
我的 dll 使用 .NET 4.6.1 构建。
Jenkins 版本:2.32.1,但我对旧版本也有同样的问题。
服务器 OS:Windows 2008 R2 企业版。
xunit.runner.console: 2.1.0
这可能是所讨论的 DLL 具有 32 位位约束的结果。
您需要
一个。 运行 32 位 运行ner(例如,如果某些 dep 需要 32 位 DLL)通过使用 dotnet xunit -x86
命令,
或
b。为 AnyCpu [或 x64] 构建测试程序集(但使用 "Prefer 32 bit" 标志)。请记住,该标志仅在 .NET 4.5 中可用,在 4.6 中不可用。
See lots more similar cases in this answer