Friday, October 9, 2015

ASP.Net MVC Namespace Compilation Error

Have you just created an ASP.Net MVC project from scratch?  You didn't like the default namespace because Visual Studio just applies the name of the project.  So, you change the namespace in the project properties, and your classes now have a nice looking namespace.

You run the debugger to take full stock of your beautiful application and this is what you get:

So, you hunt around your application, and, maybe, you find some of the default namespaces hanging around.  After making the appropriate changes, you run the debugger, again.  And, still, this error persists.  What gives?

Look here: Views/web.config.  You'll find the default namespace.  In my example, "LargeDachshund" is my default namespace, but I changed it to "com.BlogSpot.LargeDachshund" in my code.  Well, everywhere except here:

So change the namespace to your newly adopted version, and you're in business!

Woof!

No comments:

Post a Comment