Menu

“The Type or Namespace could not be found” in plain sight.

December 17, 2013 - Programming

The other day I encountered a very curious problem. My task was simple; I was simply creating a new Project, then adding references to our Libraries such that I could write that Project’s logic.

Everything seemed fine. Then I tried to compile- and got “The Type or Namespace could not be found” errors. What wizardry is this? All the References were added, even Intellisense worked for those missing classes. I Spent around 20 minutes being confused.

If my memory was better I would have remembered that this happened before. And more importantly I would have remembered how to fix it.

The fix was simple. The new Project I created in Visual Studio 2013 had the default Framework version of 4.5.1. The Projects I had added and wanted to reference were targeted for Version 4. So the problem was a mismatched .NET Target version between the Project and it’s dependency projects.

If you are getting unexplained “The Type or Namespace could not be found” Errors, you would do well to verify that this is not the case.

Have something to say about this post? Comment!