• 全部
  • C#综合技术
  • C#互联网桌面应用
  • AppLauncher
  • WinForm&WPF
  • C#开发新技术
  • 问答

急:用NUnit进行.net单元测试时,老是报错:找不到文件或程序集名称“System”,或找不到它的一个依赖项。如何解决?

liuyonglymn 龙腾天下软件 技术总监  2004-10-28 11:10:09
我在VS.NET中编译应用类和测试类都正常,但在NUnit中打开DLL文件,运行测试时就会报如下的错误,请大家帮我分析一下原因,并提出解决的办法:


有关调用实时 (JIT) 调试而不是此对话框的详细信息,
请参阅此消息的结尾。

************** 异常文本 **************
System.IO.FileNotFoundException: 找不到文件或程序集名称“System”,或找不到它的一个依赖项。
文件名:“System”

Server stack trace:
at NUnit.Core.TestRunnerThread..ctor(TestRunner runner)
at NUnit.Core.RemoteTestRunner.RunTest(EventListener listener, String[] testNames)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, 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.RunTest(EventListener listener, String[] testNames)
at NUnit.Util.TestDomain.RunTest(EventListener listener, String[] testNames)
at NUnit.Util.TestLoader.RunTests(ITest[] tests)
at NUnit.UiKit.TestSuiteTreeView.RunTests(UITestNode[] tests)
at NUnit.UiKit.TestSuiteTreeView.RunTests()
at NUnit.UiKit.TestTree.RunTests()
at NUnit.Gui.NUnitForm.runButton_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Fusion log follows:
=== Pre-bind state information ===
LOG: DisplayName = System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\AutoUnitTest\bin\Debug
LOG: Initial PrivatePath = C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\AutoUnitTest\bin\Debug
Calling assembly : nunit.core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77.
===

LOG: Publisher policy file is not found.
LOG: Host configuration file not found.
LOG: Using machine configuration file from C:\WINNT\Microsoft.NET\Framework\v1.0.3705\config\machine.config.
LOG: Post-policy reference: System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/My Documents/Visual Studio Projects/AutoUnitTest/bin/Debug/System.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/My Documents/Visual Studio Projects/AutoUnitTest/bin/Debug/System/System.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/My Documents/Visual Studio Projects/AutoUnitTest/bin/Debug/System.EXE.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/My Documents/Visual Studio Projects/AutoUnitTest/bin/Debug/System/System.EXE.



************** 已加载的程序集 **************
mscorlib
程序集版本:1.0.3300.0
Win32 版本:1.0.3705.0
基本代码:file:///c:/winnt/microsoft.net/framework/v1.0.3705/mscorlib.dll
----------------------------------------
nunit-gui
程序集版本:2.2.0.0
Win32 版本:2.2.0.0
基本代码:file:///C:/Program%20Files/NUnit%202.2/bin/nunit-gui.exe
----------------------------------------
nunit.util
程序集版本:2.2.0.0
Win32 版本:2.2.0.0
基本代码:file:///C:/Program%20Files/NUnit%202.2/bin/nunit.util.DLL
----------------------------------------
nunit.uikit
程序集版本:2.2.0.0
Win32 版本:2.2.0.0
基本代码:file:///C:/Program%20Files/NUnit%202.2/bin/nunit.uikit.DLL
----------------------------------------
System.Windows.Forms
程序集版本:1.0.3300.0
Win32 版本:1.0.3705.0
基本代码:file:///c:/winnt/assembly/gac/system.windows.forms/1.0.3300.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
程序集版本:1.0.3300.0
Win32 版本:1.0.3705.0
基本代码:file:///c:/winnt/assembly/gac/system/1.0.3300.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
程序集版本:1.0.3300.0
Win32 版本:1.0.3705.0
基本代码:file:///c:/winnt/assembly/gac/system.drawing/1.0.3300.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
nunit.core
程序集版本:2.2.0.0
Win32 版本:2.2.0.0
基本代码:file:///c:/winnt/assembly/gac/nunit.core/2.2.0.0__96d09a1eb7f44a77/nunit.core.dll
----------------------------------------
System.Windows.Forms.resources
程序集版本:1.0.3300.0
Win32 版本:1.0.3300.0
基本代码:file:///c:/winnt/assembly/gac/system.windows.forms.resources/1.0.3300.0_zh-chs_b77a5c561934e089/system.windows.forms.resources.dll
----------------------------------------
System.Xml
程序集版本:1.0.3300.0
Win32 版本:1.0.3705.0
基本代码:file:///c:/winnt/assembly/gac/system.xml/1.0.3300.0__b77a5c561934e089/system.xml.dll
----------------------------------------
mscorlib.resources
程序集版本:1.0.3300.0
Win32 版本:1.0.3300.0
基本代码:file:///c:/winnt/assembly/gac/mscorlib.resources/1.0.3300.0_zh-chs_b77a5c561934e089/mscorlib.resources.dll
----------------------------------------

************** JIT 调试 **************
若要启用实时 (JIT) 调试,此
应用程序或计算机的配置文件 (machine.config) 的
system.windows.forms 节中必须设置 jitDebugging 值。
编译应用程序时还必须启用
调试。

例如:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

启用 JIT 调试后,任何未处理的异常
将被发送到此计算机上注册的 JIT 调试器,
而不是由此对话框处理。
...全文
137 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
kaoziji 2005-06-22
你的 .NET 是 1.0的?
你的 NUnit 是 2.2?
退到 NUnit 2.1,就可以了。具体原因我也不清楚。
回复
发帖
C#
创建于2007-09-28

10.5w+

社区成员

.NET技术 C#
申请成为版主
帖子事件
创建了帖子
2004-10-28 11:10
社区公告

让您成为最强悍的C#开发者