34
votes

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:

1
I asked and answered this because the other similar questions were answered, but did not cover my specific cause.Hypnovirus
And thank you for doing that. Your post contains just the right keywords for my style of google-fu :)MetaFight
Thank you - a simple question without a load of waffle!, and a nice answer too!Vidar

1 Answers

95
votes

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.