I’ve been playing with Billy McCafferty’s S#arpArchitecture. I decided to strip the Northwind references out of the sample so I could try the framework on my own project. After removing the Northwind-specific files and renaming the remaining files and namespaces to “MyProject,” I kept getting this error when I started the application: “Multiple controllers found with the name ‘HomeController'”:
Sometimes I would instead get a message that no HomeController could be found.
The Controllers project contains one (and only one) HomeController class. If I comment out that class, the project starts fine: the home page appears as expected. There are no other occurrences of “HomeController” anywhere in the solution–so where is the HomeController that is actually running to display the home page?
With the help of Billy McAfferty in the CodePlex forum, I discovered that there were several instances of Northwind-related DLLs and other files hanging about in various bin and Debug folders, especially in the MyProject.Web\bin folder:
I deleted those files, reran the project, and voilà! I’m back to only one HomeController. (I set a breakpoint in my HomeController class just to be sure it is getting there.) Now the default page appears as expected. Just to be safe, I then followed Billy’s suggestion to delete all the bin and obj folders and then do a full rebuild: yep, still works! Thanks Billy.