我得到System.BadImageFormatException:运行单元测试的操作系统无法运行异常 [英] I am getting System.BadImageFormatException : The operating system cannot run exception while running unit tests

查看:854
本文介绍了我得到System.BadImageFormatException:运行单元测试的操作系统无法运行异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个WinForms项目。目前,我面临着一个问题,即在运行一些测试用例抛出

I am working on a Winforms project. Currently I am facing a problem that running some of the test cases throw

    System.BadImageFormatException : The operating system cannot run . 
(Exception from HRESULT: 0x800700B6)

例外。仅发生这种情况,如果我通过NUnit的运行测试。但是,如果我运行通过code中的应用程序,它工作正常。

exception. This happens only if I run tests through NUnit. However, if I run the application through the code, it works fine.

远程处理中正在使用的应用程序。可以说是一个问题?

Remoting is being used in the application. Can that be an issue?

推荐答案

确认双方NUNIT和你的code编译到同一个平台 - x86或x64。最简单的事情,该平台设置为任何CPU 在您code。

Make sure both NUNIT and your code are compiled to the same platform - x86 or x64. The easiest thing to set the platform to 'Any CPU' on your code.

这篇关于我得到System.BadImageFormatException:运行单元测试的操作系统无法运行异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆