I\'ve got a C# .NET class library MyClassLibrary that compiles fine. I\'m trying to create a unit test project for it (using Visual Studio Unit Testing Fram
I had this error using NUnit 3 in VS 2013. I solved it by deleting the assembly reference in my test project for the assembly that contained the type that was not being found, and then re-added the reference.
It happened to me when i was trying to add test project with the same main project name.
My main project name was : Calculator.OperationsManager my test project name was : Calculator.OperationsManager
i have changed the test project name as Calculator.OperationsManager.Test and everything went well.
Same message here, but I couldn't Debug the test either.
In my case, the DLL I was testing was deployed to the GAC (a BizTalk requirement). I had created a new class and was testing it, but hadn't GAC'd the DLL again since adding the class under test.
Happened to me too. It is related to building for x64, Release and x86 mode. In my case, I deleted folders in my bin (debug/release/x86 in reference assemblies and unit test) and re-run my unit test. VS2010 somewhat reported the error in Output Window. That solved it for me.
Just in case anyone needs this: I had created a test project in Visual Studio and had wondered why some Classes couldn't be found even if Visual Studio repeatedly asked me to add "System.Web" as reference.
I had done that and the error kept occurring. The problem for me was simple (and I should have checked that before, I know): I had created a test project from a template that created a .NET Core project. After changing it to .NET Framework 4.6.1 and adding "System.Web" as reference, everything worked fine.
Came through this today and though I would leave my fix.
Specs: VS 2013 / .Net 4.0
Solution: Go into Menu > Test > Test Settings > Default Processor Architechture > X64