gpt4 book ai didi

c# - 添加 NUnit 2.6.1 引用 Visual Studio 2012

转载 作者:太空狗 更新时间:2023-10-30 00:33:14 24 4
gpt4 key购买 nike

我使用的是 Visual Studio 2012,我已经下载了 NUnit 2.6.1 以对代码运行单元测试。我在需要它的解决方案项目中添加了对 nunit.framework 的引用。

问题是,出于某种原因,当我尝试包含 namespace 时它不起作用。它看起来像这样:

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework; //This is not working here

namespace SomeNamespace
{
[TestFixture] //This is not recognized..
public class SomeClassTest
{
[Test] //Neither recognized..
public void SomeMethodTest()
{
//Ok some implementation goes here..
}
}
}

关于为什么它不起作用的任何想法?提前致谢!

PS:我正在使用 ReSharper 作为 VS2012 的扩展...这会是问题的根源吗?

编辑:我尝试使用 NUGet 多次安装它,但当 NUGet 完成安装时出现相同的错误:

Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))
Successfully uninstalled 'NUnit 2.6.1'.
Install failed. Rolling back...
Failed to add reference to 'nunit.framework'.

它进行某种回滚?我正在阅读,人们说了一些关于 GAC 的内容,并手动添加了引用资料。我对此了解不多,但可能有助于回答这个问题。

最佳答案

当我从 NUGet 安装时,我有 3 到 4 次遇到同样的问题。我通过从 NUGet 卸载并重新安装来解决它。

关于c# - 添加 NUnit 2.6.1 引用 Visual Studio 2012,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12928924/

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