我有一个项目,用于在Unity3d项目中使用的一些.net 3.5 C#代码中构建DLL。在同一个解决方案中,我有一个项目,它构建一个包含NUnit测试的dll。我可以在xamarin工作室中运行这些测试,但我无法在xamarin工作室中正确调试它们。我正在尝试在visual studio中构建和运行测试,在那里我实际上可以调试它们。
我下载了NUnit Test适配器,确保两个项目都针对Any-CPU和相同版本的.NET框架。我也尝试过定位x86。如果我尝试定位x64,则测试资源管理器中不会显示任何测试。
所有测试都不会运行。如果我开始调试它会在几秒钟后停止。如何在Visual Studio中运行这些测试?测试不会调用统一函数。我试图测试的DLL(不是包含测试的DLL)引用了Unity引擎dll。我已经看到导致问题,但Xamarin工作室的测试运行良好。如果我开始运行测试,这是我在测试无法运行后在输出窗口中看到的内容:
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.x86.clr20.exe'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Microsoft.VisualStudio.TestPlatform.Core.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\SMDiagnostics\3.0.0.0__b77a5c561934e089\SMDiagnostics.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Diagnostics.ServiceModelSink\3.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll'
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Microsoft.VisualStudio.TestPlatform.Utilities.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Diagnostics.Measurement\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Diagnostics.Measurement.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.dll'
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.TmiAdapter.dll'
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.TeamSystem.Licensing.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Common\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Common.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.UnitTestFramework\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll'
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\System.Transactions\2.0.0.0__b77a5c561934e089\System.Transactions.dll'
'vstest.executionengine.x86.clr20.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll'
A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in System.ServiceModel.dll
The thread '<No Name>' (0x1ffc) has exited with code 0 (0x0).
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll
A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.IO.IOException' occurred in System.dll
The program '[5652] vstest.executionengine.x86.clr20.exe: Managed (v2.0.50727)' has exited with code 0 (0x0).
The program '[5652] vstest.executionengine.x86.clr20.exe: Program Trace' has exited with code 0 (0x0).
我尝试过的其他一些事情包括: 重启视觉工作室 删除解决方案的.sou文件 改变测试&gt;测试设置&gt;默认处理器架构