gpt4 book ai didi

未找到 NUnit 程序集

转载 作者:行者123 更新时间:2023-12-03 00:26:08 28 4
gpt4 key购买 nike

我以前使用过 NUnit,但已经有一段时间了,而且从来没有在这台机器上使用过。我在 Program Files 下解压了 2.4.8 版本,并且在尝试加载测试时不断收到此错误。

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**

为了简化问题,我编译了最基本的测试文件。

using NUnit.Framework;

namespace test
{
[TestFixture]
public class Tester
{
[Test]
public void ATest()
{
Assert.IsTrue(false, "At least the test ran!");
}
}
}

我已将“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 /out:test.dll test.cs

我尝试了 .msi 和 .zip 文件,结果相同。

最佳答案

确保您已添加对 nunit.framework 的引用。如果有,请确保该引用的属性将复制本地属性设置为 true。

关于未找到 NUnit 程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/176850/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com