M.Y. Babt
M.Y. Babt

Reputation: 2921

"nunit.framework.dll" could not be found

I am following the NUnit tutorial here.

My source files live in the folder C:\Users\Me\Documents\Visual Studio 2015\Projects\NUnitTest\NUnitTest. My NUnit DLL lives in the folder C:\Program Files (x86)\NUnit.org\framework\3.2.0.0\portable\nunit.framework.dll. I am certain that these paths are correct.

To compile the source file AccountTest.cs into a DLL, I ran the following commands:

cd C:\Users\Me\Documents\Visual Studio 2015\Projects\NUnitTest\NUnitTest
C:\Users\Me\Documents\Visual Studio 2015\Projects\NUnitTest\NUnitTest>csc /target:library /out:AccountTest.DLL /r:C:\Program Files (x86)\NUnit.org\framework\3.2.0.0\portable\nunit.framework.dll AccountTest.cs

However, I see these error messages:

error CS2001: Source file 'C:\Users\Me\Documents\Visual Studio 2015\Projects\N
UnitTest\NUnitTest\Files' could not be found.
error CS2001: Source file 'C:\Users\Me\Documents\Visual Studio 2015\Projects\N
UnitTest\NUnitTest\(x86)\NUnit.org\framework\3.2.0.0\portable\nunit.framework.dl
l' could not be found.

Any advice?

EDIT: I didn't forget to add a reference to NUnit inside of my solution. I also included the appropriate using statement.

Upvotes: 0

Views: 5749

Answers (2)

Rob Prouse
Rob Prouse

Reputation: 22657

It is because you did not quote the path to the NUnit assembly when you compiled from the command line. It should be this,

csc /target:library /out:AccountTest.DLL /r:"C:\Program Files (x86)\NUnit.org\framework\3.2.0.0\portable\nunit.framework.dll" AccountTest.cs

You should also know that the NUnit Console cannot run tests using the portable version of the framework at the moment. To do that, you need to create a self-executing test assembly using NUnitLite. For now, it would be easier for you to just use the .NET 4.5 version of the framework.

Is there any reason you are compiling at the command line? Visual Studio Community Edition is free and will handle compiling for you. If you are not on Windows, MonoDevelop is another good option.

Upvotes: 2

Nonagon
Nonagon

Reputation: 407

Have you added a reference to your Solution?

right click Solution hover over add click reference search for Nunit reference and add it

Also, make sure that you have added a using statement at the top of your project on all classes

Upvotes: 0

Related Questions