问题
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