Namespace change - Multiple types were found that match the controller named 'Home'

Hypnovirus picture Hypnovirus · Jul 27, 2012 · Viewed 9.6k times · Source

I ran into the following problem after changing the namespace for my mvc project:

Multiple types were found that match the controller named 'Home'. This can happen if the route that services this request ('{controller}/{action}/{id}') does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces' parameter.

The request for 'Home' has found the following matching controllers:

oldns.Controllers.HomeController

newns.Controllers.HomeController

There are other answered questions about this error, but cover other causes:

Answer

Hypnovirus picture Hypnovirus · Jul 27, 2012

After doing some research, I found that the cause was the old mvc app dll remaining in the bin folder (bin\oldns.dll). Clean was not clearing it out. I manually deleted the contents of the bin directory and then all was well.