Nunit DLL issue - Namespace can't be found?

我们两清 提交于 2019-12-11 10:56:21

问题


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:

"The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)"

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.

Thanks for any advice!


回答1:


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.



来源:https://stackoverflow.com/questions/36773062/nunit-dll-issue-namespace-cant-be-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!