未找到 NUnit 程序集 [英] NUnit assembly not found
问题描述
我以前使用过 NUnit,但有一段时间没有使用过,而且从未在这台机器上使用过.我在 Program Files
下解压了 2.4.8 版,并且在尝试加载我的测试时不断收到此错误.
无法加载文件或程序集nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77"或其依赖项之一.系统找不到指定的文件**
为了简化问题,我编译了最基础的可能的测试文件.
使用NUnit.Framework;命名空间测试{[测试夹具]公开课测试员{[测试]公共无效 ATest(){Assert.IsTrue(false, "至少测试运行了!");}}}
我已将C:\Program Files\NUnit-2.4.8-net-2.0\bin"添加到我的 PATH(并重新启动).请注意,如果我将测试程序集复制到该文件夹中,则
<前>C:\Program Files\NUnit-2.4.8-net-2.0\bin>nunit-console test.dll有效,但是
<前>C:\Program Files\NUnit-2.4.8-net-2.0\bin>nunit-console c:\dev\nunit_test\test.dll和
<前>C:\dev\nunit_test>nunit_console test.dll因上述错误而失败.
想必我可以通过将 NUnit.Framework DLL 文件复制到我项目的 bin
文件夹中来解决这个问题,但我不记得过去必须这样做.此外,我在 GUI 中遇到了同样的错误.GUI 不应该知道框架的位置(即在同一文件夹中)吗?
我没有使用 Visual Studio.我使用以下行来编译测试项目.
<前>%windir%\Microsoft.NET\Framework\v2.0.50727\csc.exe/r:"C:\Program Files\NUnit-2.4.8-net-2.0\bin\nunit.framework.dll"/t:library/出:test.dll test.cs我尝试了 .msi 和 .zip 文件,结果相同.
如果您使用 NUnit-2.4.8-net-2.0.msi 安装,NUnit 程序集将添加到 GAC.
您也可以通过从 Visual Studio 2005 命令提示符运行 gacutil 来手动重新安装.
I've used NUnit before, but not in a while, and never on this machine. I unzipped version 2.4.8 under Program Files
, and I keep getting this error when trying to load my tests.
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**
In order to simplify the problem, I've compiled the most basic possible test file.
using NUnit.Framework;
namespace test
{
[TestFixture]
public class Tester
{
[Test]
public void ATest()
{
Assert.IsTrue(false, "At least the test ran!");
}
}
}
I've added "C:\Program Files\NUnit-2.4.8-net-2.0\bin" to my PATH (and rebooted). Note that if I copy the test assembly into that folder, then
C:\Program Files\NUnit-2.4.8-net-2.0\bin>nunit-console test.dll
works, but
C:\Program Files\NUnit-2.4.8-net-2.0\bin>nunit-console c:\dev\nunit_test\test.dll
and
C:\dev\nunit_test>nunit_console test.dll
fail with the above error.
Presumably I could get around this by copying the NUnit.Framework DLL file into my project's bin
folder, but I don't remember having to do this in the past. Moreover, I get the same error in the GUI. Shouldn't the GUI know where the framework is located (that is, in the same folder)?
I'm not using Visual Studio. I use the following line to compile the test project.
%windir%\Microsoft.NET\Framework\v2.0.50727\csc.exe /r:"C:\Program Files\NUnit-2.4.8-net-2.0\bin\nunit.framework.dll" /t:library /out:test.dll test.cs
I tried both the .msi and the .zip file with the same result.
If you install using NUnit-2.4.8-net-2.0.msi, the NUnit assemblies are added to the GAC.
You can also reinstall manually by running gacutil from the Visual Studio 2005 command prompt.
这篇关于未找到 NUnit 程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!