从 NAnt 0.91-alpha2 启动时,NUnit 2.4.6 无法找到 log4n 1.2.10
我有一个 .NET 3.5 Web 应用程序,并且正在添加 Silverlight 4。我可以在 VS 2010 中构建和测试整个项目。我的程序集仍然以 3.5 为目标。我必须将 NAnt 从 .85 升级到 .91-alpha2 才能使构建完全正常工作,并且我必须使用对 msbuild v4.0.30319 的调用而不是 NAnt 的任务。现在一切都正常了(尽管如果有人有改进建议,我愿意接受)。
构建完成后,NAnt 启动单元测试。我的问题是它立即失败,因为 NUnit 找不到正确的 log4n.dll。输出如下(添加省略号以混淆某些文件夹名称)。 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 ---
I have a .NET 3.5 web application, and I am adding Silverlight 4. I can build and test the whole project in VS 2010. My assemblies still targets 3.5. I had to upgrade NAnt from .85 to .91-alpha2 to get the build to work at all, and I had to use an call to msbuild v4.0.30319 rather than NAnt's task. That all works now (though if anybody has suggestions for improvement, I'm open to them).
After the build, NAnt launches unit tests. My problem is that it immediately fails because NUnit can't find the right log4n.dll. The output is below (elipses added to obfuscate some folder names). NAnt uses log4n 1.2.9, and NUnit uses 1.2.10. Each application has the correct version in its install directory. NAnt loads its version, which is in use when it launches NUnit, but I don't see why there is a conflict. I suspect the problem has something to do with NAnt .91-alpha2, and I can't think of a work-around.
[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 ---
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 OP,该错误已通过更新 NUnit 解决:
According the OP, the error was resolved by updating NUnit: