我有一个C++/CLI DLL使用一些C++ DLL(都为32位构建)。我想通过使用NUnit 2.5.8.10295一个C#DLL中对其进行测试(更改为2.6.4并没有改变结果)NUnit:无法加载文件或程序集'some.dll'或其某个依赖项。无法找到指定的模块
我用这到底被扩大到这个批处理文件:
nunit-console-x86.exe "someUnitTests.dll" /framework=4.0.30319 /xml=NUnitResult_someUnitTests.xml
使用此命令,我的开发PC(64位Win 10 Enterprise Visual Studio 2013)上的测试运行良好。当从Visual Studio Professional 2013启动nunit-console-x86.exe并将工作目录设置为两个DLL的输出文件夹时,它也能正常工作。
当构建服务器上执行的测试失败,此消息(在Windows Server 2012 R2上运行詹金斯):
SetUp : System.IO.FileLoadException : Could not load file or assembly 'some.DLL' or one of its dependencies. A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)
我试图在两台机器上比较安装框架和运行时(没有看到明显除了使用VS 2013 Express构建服务器之外,还有很大的差异我也尝试过使用SysInternals ProcessMonitor,但没有成功。依赖沃克的输出我不明白。
任何有关使用技巧或工具的提示?
更新: 如果我添加/ noshadow它不会在我的开发PC上运行了。在Visual Studio中,nunit-console-x86崩溃,而在命令行上,我收到了与buildserver上相同的消息。在没有任何Visual Studio但使用vc_redist 2013的情况下,测试计算机与Windows 7进行了更仔细的观察:启用了阴影复制(=没有/ noshadow)我得到这个:
SetUp : System.IO.FileNotFoundException : Could not load file or assembly 'some.DLL' or one of its dependencies. The specified module could not be found.
随着/ noshadow错误默认变成BadImageFormatException
谢谢。我试过并更新了这个问题。 –
我还发现测试PC上的错误消息与buildserver上的错误消息不同...... –
当您的某个程序集是x64并且您正在运行x86或反之亦然时,通常会看到BadImageFormatException。 –