NUnit 2.4.6 unable to find log4n 1.2.10 when launched from NAnt 0.91-alpha2
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.50开发者_StackOverflow社区727\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 ---
According the OP, the error was resolved by updating NUnit:
NUnit 2.4.6 was broken by something I installed, because I get the error when I run the NUnit GUI alone. I do not get the error on a new version I installed (2.5.7).
精彩评论