TeamCity and NUnit no longer friends

Hey I'm running TeamCity Version 4.5 (build 8944). The project in question is using NUnit 2.4.8 (whose binaries are included in source control in a "lib" folder) and all tests run successfully in the IDE using Resharper.  TeamCity also runs all tests successfully, but because of the below error flags the build a failure.

Any ideas what's going on here?

Result: Tests passed: 39, ignored: 2 Agent: devtrunk

2 tests ignored

  • CASUserDaoTest.testGetCASUserRolesForAppByOrg                   View test details (CasLibTest.dll: CasLibTest.DAO) - code for handling roles by org not yet implemented
  • SessionDAOTest.SessionCreate                   View test details (CasLibTest.dll: CasLibTest.DAO) - Method SessionCreate's signature is not correct: it must return void.

39 tests passed

Build errors

[10:45:16]: Project "CAS2_New.sln.teamcity.patch.tcprojx" (Build_TeamCity_generated_c581c40e40494008b224a19482a13416;NUnit_TeamCity_generated_c581c40e40494008b224a19482a13416 target(s)): (37s)
[10:45:52]: NUnit Error: Could not load file or assembly 'nunit.framework, Version=2.4.1.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
StackTrace:

Server stack trace:
at System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)
at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)
at System.Reflection.RuntimeMethodInfo.GetCustomAttributes(Boolean inherit)
at NUnit.Core.Reflect.HasAttribute(MemberInfo member, String attrName, Boolean inherit)
at NUnit.Core.Reflect.GetMethodWithAttribute(Type fixtureType, String attributeName, BindingFlags bindingFlags, Boolean inherit)
at NUnit.Core.Builders.NUnitTestFixtureBuilder.MakeSuite(Type type)
at NUnit.Core.Builders.AbstractFixtureBuilder.BuildFrom(Type type)
at NUnit.Core.Extensibility.SuiteBuilderCollection.BuildFrom(Type type)
at NUnit.Core.TestFixtureBuilder.BuildFrom(Type type)
at NUnit.Core.Builders.TestAssemblyBuilder.GetFixtures(Assembly assembly, String ns)
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.RemoteTestRunner.Load(TestPackage package)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

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:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\NUnit-2.4\NUnitRunner.cs:line 43
at JetBrains.TeamCity.NUnitLauncher.AssemblyTest.LoadTestDomain() in c:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\AssemblyTest.cs:line 71
at JetBrains.TeamCity.NUnitLauncher.LoadTestDomainAction.Action(AssemblyTest test) in c:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\LoadTestDomainAction.cs:line 14
at JetBrains.TeamCity.NUnitLauncher.TryOneAssemblyTest.Action() in c:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\TryOneAssemblyTest.cs:line 18
at JetBrains.TeamCity.NUnitLauncher.TryOneAssembly.Do() in c:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\TryOneAssembly.cs:line 29

[10:45:53]: Failure executing test(s) on assembly D:\BuildAgent\work\CAS2\CentralAppCoreTest\bin\Release\CACTest.dll with NUnit 2.4.8.0. Could not load file or assembly 'nunit.framework, Version=2.4.1.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
StackTrace:

Server stack trace:
at System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)
at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)
at System.Reflection.RuntimeMethodInfo.GetCustomAttributes(Boolean inherit)
at NUnit.Core.Reflect.HasAttribute(MemberInfo member, String attrName, Boolean inherit)
at NUnit.Core.Reflect.GetMethodWithAttribute(Type fixtureType, String attributeName, BindingFlags bindingFlags, Boolean inherit)
at NUnit.Core.Builders.NUnitTestFixtureBuilder.MakeSuite(Type type)
at NUnit.Core.Builders.AbstractFixtureBuilder.BuildFrom(Type type)
at NUnit.Core.Extensibility.SuiteBuilderCollection.BuildFrom(Type type)
at NUnit.Core.TestFixtureBuilder.BuildFrom(Type type)
at NUnit.Core.Builders.TestAssemblyBuilder.GetFixtures(Assembly assembly, String ns)
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.RemoteTestRunner.Load(TestPackage package)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

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:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\NUnit-2.4\NUnitRunner.cs:line 43
at JetBrains.TeamCity.NUnitLauncher.AssemblyTest.LoadTestDomain() in c:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\AssemblyTest.cs:line 71
at JetBrains.TeamCity.NUnitLauncher.LoadTestDomainAction.Action(AssemblyTest test) in c:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\LoadTestDomainAction.cs:line 14
at JetBrains.TeamCity.NUnitLauncher.TryOneAssemblyTest.Action() in c:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\TryOneAssemblyTest.cs:line 18
at JetBrains.TeamCity.NUnitLauncher.TryOneAssembly.Do() in c:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\TryOneAssembly.cs:line 29

[10:45:53]: Could not load file or assembly 'nunit.framework, Version=2.4.1.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
StackTrace:

Server stack trace:
at System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)
at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)
at System.Reflection.RuntimeMethodInfo.GetCustomAttributes(Boolean inherit)
at NUnit.Core.Reflect.HasAttribute(MemberInfo member, String attrName, Boolean inherit)
at NUnit.Core.Reflect.GetMethodWithAttribute(Type fixtureType, String attributeName, BindingFlags bindingFlags, Boolean inherit)
at NUnit.Core.Builders.NUnitTestFixtureBuilder.MakeSuite(Type type)
at NUnit.Core.Builders.AbstractFixtureBuilder.BuildFrom(Type type)
at NUnit.Core.Extensibility.SuiteBuilderCollection.BuildFrom(Type type)
at NUnit.Core.TestFixtureBuilder.BuildFrom(Type type)
at NUnit.Core.Builders.TestAssemblyBuilder.GetFixtures(Assembly assembly, String ns)
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.RemoteTestRunner.Load(TestPackage package)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

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:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\NUnit-2.4\NUnitRunner.cs:line 43
at JetBrains.TeamCity.NUnitLauncher.AssemblyTest.LoadTestDomain() in c:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\AssemblyTest.cs:line 71
at JetBrains.TeamCity.NUnitLauncher.LoadTestDomainAction.Action(AssemblyTest test) in c:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\LoadTestDomainAction.cs:line 14
at JetBrains.TeamCity.NUnitLauncher.TryOneAssemblyTest.Action() in c:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\TryOneAssemblyTest.cs:line 18
at JetBrains.TeamCity.NUnitLauncher.TryOneAssembly.Do() in c:\Agent\work\e79e24c442942018\src\NUnitLauncher\src\TryOneAssembly.cs:line 29

[10:45:53]: [Project "CAS2_New.sln.teamcity.patch.tcprojx" (Build_TeamCity_generated_c581c40e40494008b224a19482a13416;NUnit_TeamCity_generated_c581c40e40494008b224a19482a13416 target(s)):] D:\BuildAgent\work\CAS2\CAS2_New.sln.teamcity.patch.tcprojx(10, 5): D:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe "@@" D:\BuildAgent\temp\buildTmp\tmp14F6.tmp exited with code 1.
1 comment
Comment actions Permalink

What way to you run NUnit tests from TeamCity, could you please attach screenshot or code part.
Please check all project references to NUnit 2.4.8. Please check NUnit 2.4.1 was not installed in GAC on build agent machine.
What version of NUnit runner do you use in TeamCity NUnit runner?

Check references of test assmeblies on build agent work folder. What verison of nunit.framework.dll is referenced? You may use Reflector for that.

Thanks!

0

Please sign in to leave a comment.