Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用NUnit在64位windows上测试32位程序集_C#_.net_Unit Testing_Nunit - Fatal编程技术网

C# 使用NUnit在64位windows上测试32位程序集

C# 使用NUnit在64位windows上测试32位程序集,c#,.net,unit-testing,nunit,C#,.net,Unit Testing,Nunit,我正在使用C#和.NET4.0构建我当前的应用程序。对于单元测试,我使用它的最新版本 在我的应用程序中,我必须使用32位DLL,因此我必须创建目标为“x86”的程序集 应用程序本身在32位和64位Windows下都可以正常工作,但我不能使用NUnit,因为加载“x86”程序集时会出现以下异常: 在设置->程序集隔离中,我使用“在每个程序集的单独进程中运行测试”,但没有任何用处 System.BadImageFormatException... Server stack trace: b

我正在使用C#和.NET4.0构建我当前的应用程序。对于单元测试,我使用它的最新版本

在我的应用程序中,我必须使用32位DLL,因此我必须创建目标为“x86”的程序集

应用程序本身在32位和64位Windows下都可以正常工作,但我不能使用NUnit,因为加载“x86”程序集时会出现以下异常:

在设置->程序集隔离中,我使用“在每个程序集的单独进程中运行测试”,但没有任何用处

System.BadImageFormatException...

Server stack trace: 
   bei System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   bei System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   bei System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   bei NUnit.Core.Builders.TestAssemblyBuilder.Load(String path)
   bei NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
   bei NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
   bei NUnit.Core.TestSuiteBuilder.BuildSingleAssembly(TestPackage package)
   bei NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
   bei NUnit.Core.SimpleTestRunner.Load(TestPackage package)
   bei NUnit.Core.ProxyTestRunner.Load(TestPackage package)
   bei NUnit.Core.ProxyTestRunner.Load(TestPackage package)
   bei NUnit.Core.RemoteTestRunner.Load(TestPackage package)
   bei System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   bei System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]: 
   bei System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   bei System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   bei NUnit.Core.TestRunner.Load(TestPackage package)
   bei NUnit.Util.TestDomain.Load(TestPackage package)
   bei NUnit.Core.ProxyTestRunner.Load(TestPackage package)
   bei NUnit.Util.RemoteTestAgent.AgentRunner.Load(TestPackage package)
   bei System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   bei System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [1]: 
   bei System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   bei System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   bei NUnit.Core.TestRunner.Load(TestPackage package)
   bei NUnit.Core.ProxyTestRunner.Load(TestPackage package)
   bei NUnit.Util.ProcessRunner.Load(TestPackage package)
   bei NUnit.Util.AggregatingTestRunner.Load(TestPackage package)
   bei NUnit.Util.TestLoader.LoadTest(String testName)

如何在64位版本的Windows上运行这些测试?

中回答了这个问题。(参考Ian Ringrose对该问题的评论。)

另请参见(nunit-x86.exe对我有效)谢谢!在搜索中没有找到这个。请给我一个答案,这样我就可以投票了!