Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Renaming namespace in ASP.NET MVC Project: compile OK, Running not OK

Tags:

asp.net-mvc

How to fix ?

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: MyProject1.Controllers.HomeController MyProject2.Controllers.HomeController

like image 628
user310291 Avatar asked Mar 23 '11 22:03

user310291


3 Answers

Probably need a little bit more details. For e.g. Did you change the namespace from MyProject1 to MyProject2?

Check your bin folder to see if any of dlls from the old namespace are still around. If that's the case cleaning them up and recompiling should fix the issue.

like image 80
Naraen Avatar answered Nov 15 '22 11:11

Naraen


Make sure you edit the default namespace setting in your web project properties, on the Application tab.

like image 40
Winger Avatar answered Nov 15 '22 10:11

Winger


I assume this is in your Views. Be certain the namespaces in your views is correct.

like image 30
rcravens Avatar answered Nov 15 '22 12:11

rcravens