7

I am getting this error with my new unit test:

Unable to get type MyTestProject.MyTestClass, MyTestProject. Error: Could not load type 'MyTestProject.MyTestClass' from assembly 'MyTestProject'..

I have other tests in the project that were working just fine and now they are all showing a similar error message.

If I run the test in Resharper (rather than the built in Visual Studio Test runner) then it works fine. (I would just use that, but it is slower.)

Any idea what this could mean?

3 Answers 3

8

It's also happens when library under test is in GAC. It's offen case when you develop for SharePoint.

Remove library from GAC if you don't need it there or deploy newest version to GAC.

Sign up to request clarification or add additional context in comments.

1 Comment

I've used Reflector to re-generate PDBs; it set DEVPATH to power further debugging. DEVPATH is similar to GAC, so clearing it solved the mystery. Thank you Sebastian!
7

It seems to me that the Visual Studio unit test runner is a little bit behind on the naming of your unittests. This sometimes happens when you rename a namespace or class.

This should clear the interenal cache: unload the project from your solution, run all tests, than reload the project.

Worked for me.

Comments

1

I fixed this for myself by cleaning the test project and then building it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.