Nunit DLL 问题 - 找不到命名空间? [英] Nunit DLL issue - Namespace can't be found?
问题描述
我通过 NuGet 安装了 NUnit.NUnit 出现在我的项目引用中,似乎没有问题.
I installed NUnit via NuGet. NUnit shows up in my project references, and there doesn't appear to be a problem.
我创建了一个测试类,只是为了确保它正确加载:
I created a test class, just to make sure it loaded correctly:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
namespace MyNamespace
{
[TestFixture]
public class UnitTests
{
[Test]
public void TestMethod()
{
}
}
}
但是,在构建时,我得到:
However, when building, I get:
找不到类型或命名空间名称‘NUnit’(您是否缺少 using 指令或程序集引用?)"
"The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)"
我手动删除并重新添加了适合我的项目(适用于 .Net 4.0)的 DLL,但没有成功 - 我在构建时继续遇到错误.
I removed and re-added the appropriate DLL for my project (for .Net 4.0) manually, yet no success - I continue to get the error when building.
是否有我遗漏的潜在问题?
Is there a potential issue I'm missing?
有一些类似的问题,但答案对我的问题不起作用.
There some similar questions, but the answers did not work for my issue.
感谢您的建议!
推荐答案
事实证明,我将项目属性中的目标框架设置为.NET Framework 4 Client Profile".我把它改成了.Net Framework 4",问题就解决了.
As it turns out, I had the target framework in the project properties set to ".NET Framework 4 Client Profile." I changed it to ".Net Framework 4", and the problem is solved.
对于那些寻求进一步修复的人,请参阅这个解决方案.
For those looking for further fixes, see this solution.
这篇关于Nunit DLL 问题 - 找不到命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!