简体   繁体   中英

Could not load file or assembly MyNunitTest.dll or one of its dependencies

I cannot run Nunit in the newest .NET. Here are all the steps I do:

  1. New Project > Class Library (Package)
  2. Add NUnit 3.0.1
  3. Add the class:

Content:

using NUnit.Framework;

namespace MyNunitTest
{
    [TestFixture]
    public class TestClass
    {
        [Test]
        public void TestMethod()
        {
            Assert.That(true, Is.True);
        }
    }
}
  1. Run All

Error:

System.IO.FileNotFoundException: Could not load file or assembly MyNunitTest.dll or one of its dependencies. The system cannot find the file specified.

使用Resharper 9.2时,我遇到了同样的问题,也许您在更新时会解决您的问题。

The solution for the main problem here is that the wrong project type has been chosen.

To add a unit test project add a new Unit test project instead of a class library or any other type of project. Everything will work as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM