title: Why won't my nunit tests run in visual studio 2012?
body: <p>I've got a project that builds a DLL out of some .net 3.5 C# code to be used in a unity3d project.  In the same solution, I have a project that builds a dll which contains NUnit tests.  I can run these tests in xamarin studio, but I can't debug them properly in xamarin studio.  I'm trying to build and run the tests in visual studio, where I'll actually be able to debug them. </p>
  
  <p>I downloaded the NUnit Test adapter, ensured both projects are targeting Any-CPU and the same version of the .NET framework.  I also tried targeting x86.  If I try to target x64, none of the tests appear in the test explorer.  </p>
  
  <p>None of the tests will run.  If I start to debug it stops after a few seconds.  How do I get these tests to run in visual studio?  The tests don't call unity functions.  The dll I'm trying to test (not the DLL which contains the tests) references the unity engine dll.  I've seen that cause problems, but the tests run fine in Xamarin studio.  If I begin to run a test, this is what I see in the output window after the test fails to run:</p>
  
  <pre><code>'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 '&lt;No Name&gt;' (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).
  </code></pre>
  
  <p>Some other things I tried include:
  restarting visual studio
  deleting the solution's .sou file
  changing test> test settings > default processor architecture</p>