当从NAnt 0.91-alpha2启动时,NUnit 2.4.6无法找到log4n 1.2.10

时间:2010-10-21 17:59:05

标签: msbuild nunit nant

我有一个.NET 3.5 Web应用程序,我正在添加Silverlight 4.我可以在VS 2010中构建和测试整个项目。我的程序集仍然以3.5为目标。我不得不将NAnt从.85升级到.91-alpha2以使构建完全正常工作,我不得不使用msbuild v4.0.30319而不是NAnt的任务。这一切现在都有效(尽管如果有人提出改进建议,我会向他们开放)。

构建之后,NAnt启动单元测试。我的问题是它立即失败,因为NUnit找不到合适的log4n.dll。输出如下(添加了elipses来模糊某些文件夹名称)。 NAnt使用log4n 1.2.9,NUnit使用1.2.10。每个应用程序在其安装目录中都有正确的版本。 NAnt加载它的版本,它在启动NUnit时正在使用,但我不明白为什么会发生冲突。我怀疑这个问题与NAnt .91-alpha2有关,我想不出一个解决方法。

 [exec] Unhandled Exception:
 [exec] System.TypeInitializationException: The type initializer for 'NUnit.Core.RemoteTestRunner' threw an exception.
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' 
or one of its dependencies. The system cannot find the file specified.
 [exec] File name: 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821'
 [exec]    at NUnit.Core.RemoteTestRunner..cctor()
 [exec] 
 [exec] Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
 [exec] Running under executable  C:\Program Files\NUnit 2.4.6\bin\nunit-console.exe
 [exec] --- A detailed error log follows. 
 [exec] 
 [exec] === Pre-bind state information ===
 [exec] LOG: User = ...
 [exec] LOG: DisplayName = log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821
 [exec]  (Fully-specified)
 [exec] LOG: Appbase = file:///c:/AutomatedBuild/sourcecode/.../bin/Debug
 [exec] LOG: Initial PrivatePath = NULL
 [exec] Calling assembly : nunit.core, Version=2.4.6.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77.
 [exec] ===
 [exec] LOG: This bind starts in default load context.
 [exec] LOG: No application configuration file found.
 [exec] LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
 [exec] LOG: Post-policy reference: log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821
 [exec] LOG: Attempting download of new URL file:///c:/AutomatedBuild/sourcecode/.../bin/Debug/log4net.DLL.
 [exec] LOG: Attempting download of new URL file:///c:/AutomatedBuild/sourcecode/.../bin/Debug/log4net/log4net.DLL.
 [exec] LOG: Attempting download of new URL file:///c:/AutomatedBuild/sourcecode/.../bin/Debug/log4net.EXE.
 [exec] LOG: Attempting download of new URL file:///c:/AutomatedBuild/sourcecode/.../bin/Debug/log4net/log4net.EXE.
 [exec] 
 [exec]    --- End of inner exception stack trace ---

1 个答案:

答案 0 :(得分:0)

根据OP,通过更新NUnit来解决错误:

  

NUnit 2.4.6被我安装的东西打破了,因为当我单独运行NUnit GUI时出现错误。我没有在我安装的新版本(2.5.7)上收到错误。