I'm trying to get TeamCity to run NUnit tests as set up in an NAnt script as follows:
<nunit2>
<formatter type="Xml"
usefile="true"
extension=".xml"
outputdir="${BuildArea.ReportsDir}" />
<test assemblyname="${BuildArea.OutputDir}\Common.Tests.dll"
appconfig="src\Common.Tests\Tests.config" />
</nunit2>
Manually running the build script from the command line on the buildserver/agent machine runs the tests just fine so i know that there's no problem with the build script itself. However when a build runs from within TeamCity i always get the error:
"Could not locate the assembly nunit.Framework"
I've come across a related post (http://devnet.jetbrains.net/message/5211436#5211436) which recommends placing nunit.framework at the same location as the dll containings the tests but i was doing this already and i'm still getting the same error. Installing to the GAC is not an option.
Anyone has any idea how to fix this? I've spent hours trying to figure out what might be the problem but i can't see what i might be doing wrong.
Thanks
Exact error and stack trace follows:
[23:48:02]: Start TeamCity NUnit Test Runner
[23:48:02]:
NUnit Error: System.IO.FileNotFoundException: Could not load file or assembly 'nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The system cannot find the file specified. File name: 'nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77'
Server stack trace: at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at NUnit.Core.TestFramework.FromAssembly(Assembly assembly) at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path) at NUnit.Core.Builders.TestAssemblyBuilder.Build() at NUnit.Core.Builders.TestAssemblyBuilder.Build(String testName) at NUnit.Core.TestSuiteBuilder.Build(String assemblyName, String testName) at NUnit.Core.SimpleTestRunner.Load(String assemblyName, String testName) at NUnit.Core.SimpleTestRunner.Load(String assemblyName) at NUnit.Core.ProxyTestRunner.Load(String assemblyName) at NUnit.Core.ProxyTestRunner.Load(String assemblyName) 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(String assemblyName) at JetBrains.TeamCity.NUnitLauncher.NUnitRunner.LoadTest(String testAssembly, String testName, TestRunner runner) in c:\Agent\work\e34bdcb45e12f223\src\NUnitLauncher\src\NUnit-2.2\NUnitRunner.cs:line 33 at JetBrains.TeamCity.NUnitLauncher.AssemblyTest.LoadTestDomain() in c:\Agent\work\e34bdcb45e12f223\src\NUnitLauncher\src\AssemblyTest.cs:line 71 at JetBrains.TeamCity.NUnitLauncher.LoadTestDomainAction.Action(AssemblyTest test) in c:\Agent\work\e34bdcb45e12f223\src\NUnitLauncher\src\LoadTestDomainAction.cs:line 14 at JetBrains.TeamCity.NUnitLauncher.TryOneAssemblyTest.Action() in c:\Agent\work\e34bdcb45e12f223\src\NUnitLauncher\src\TryOneAssemblyTest.cs:line 18 at JetBrains.TeamCity.NUnitLauncher.TryOneAssembly.Do() in c:\Agent\work\e34bdcb45e12f223\src\NUnitLauncher\src\TryOneAssembly.cs:line 31