NUnit failure - MSIL versus x64

Hi,

I am setting up TeamCity 7.1.4 on Windows Server 2012 (64 bit) box for a .NET project. When running the NUnit step of our build, I am running into a persistent issue:

System.IO.FileNotFoundException: Could not load file or assembly XXXXXX


After the stack trace  there is the following:

Check correct .NET Framework version and process platform (x64, x86, MSIL) are used both in the test runner settings and involved assemblies on this machine.

From reading in this forum, this is often due to a mismatch between the assemblies and the version of NUnit chosen. I chose the NUnit test runner using:

NUnit runner: NUnit 2.6.2

.Net Runtime:
Platform: auto (MSIL)
Version: v4.0

All these match our .NET project, but I still see this NUnit build failure. I do see these lines:


Loading assembly is compiled for v4.0.30319, MSIL
NUnit runner runtime is v4.0.30319, x64


Should NUnit runner runtime say MSIL instead of x64, to match my assemblies? I set it to MSIL. If this is not the issue, do you know what could be?

Thanks for any insight. I have added the complete stack trace below.



----------------------------------------------------------------------------------------------------------

[Step 2/2] NUnit error running tests in 'C:\TeamCity\buildAgent\work\8487a541035daf1c\obj\Release\XXXXXXXX.dll' assembly


Loading assembly is compiled for v4.0.30319, MSIL


NUnit runner runtime is v4.0.30319, x64


System.IO.FileNotFoundException: Could not load file or assembly 'XXXXXXXX, Version=1.0.4815.41218, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.


File name: 'XXXXXXXXXXXX, Version=1.0.4815.41218, Culture=neutral, PublicKeyToken=null'


Server stack trace:


   at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)


   at System.Reflection.RuntimeAssembly.GetExportedTypes()


   at NUnit.Core.CoreExtensions.InstallAdhocExtensions(Assembly assembly)


   at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path)


   at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)


   at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)


   at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)


   at NUnit.Core.SimpleTestRunner.Load(TestPackage package)


   at NUnit.Core.ProxyTestRunner.Load(TestPackage package)


   at NUnit.Core.ProxyTestRunner.Load(TestPackage package)


   at NUnit.Core.RemoteTestRunner.Load(TestPackage package)


   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)


   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)


Exception rethrown at [0]:


   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)


   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)


   at NUnit.Core.TestRunner.Load(TestPackage package)


   at JetBrains.TeamCity.NUnitLauncher.NUnitRunner.LoadTest(String testAssembly, String testName, TestRunner runner) in c:\BuildAgent\work\4fb4fc7600eac5a9\src\NUnitLauncher\src\NUnit-2.6\NUnitRunner.cs:line 53


   at JetBrains.TeamCity.NUnitLauncher.AssemblyTest.LoadTestDomain() in c:\BuildAgent\work\4fb4fc7600eac5a9\src\NUnitLauncher\src\AssemblyTest.cs:line 76


   at JetBrains.TeamCity.NUnitLauncher.LoadTestDomainAction.Action(AssemblyTest test) in c:\BuildAgent\work\4fb4fc7600eac5a9\src\NUnitLauncher\src\LoadTestDomainAction.cs:line 17


   at JetBrains.TeamCity.NUnitLauncher.TryOneAssemblyTest.Action() in c:\BuildAgent\work\4fb4fc7600eac5a9\src\NUnitLauncher\src\TryOneAssemblyTest.cs:line 18


   at JetBrains.TeamCity.NUnitLauncher.TryOneAssembly.Do() in c:\BuildAgent\work\4fb4fc7600eac5a9\src\NUnitLauncher\src\TryOneAssembly.cs:line 31


WRN: Assembly binding logging is turned OFF.


To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.


Note: There is some performance penalty associated with assembly bind failure logging.


To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

[22:55:27][Step 2/2] Check correct .NET Framework version and process platform (x64, x86, MSIL) are used both in the test runner settings and involved assemblies on this machine.

1 comment
Comment actions Permalink

For those that have run into a similar problem, please see http://youtrack.jetbrains.com/issue/TW-26697 as to how this was resolved. In the end, the obj folder needed to be excluded from the test path.

0

Please sign in to leave a comment.