views:

513

answers:

1

Hi

I have been following this tutorial:

http://msdn.microsoft.com/en-us/library/ee307987(VS.100).aspx#registering_routes_in_account_and_store_areas

and have an application (a bit more complex) like this set up. All the areas are working fine, however I have noticed that if I change the project name of the Accounts project to say Areas.Accounts, that it wont find any of my views within the accounts project due to the Area name not being the same as the project name e.g. the accounts routes.cs file still has this:

public override string AreaName
 {
  get { return "Accounts"; }
 }

Does anyone know why I would have to change it to this:

public override string AreaName
 {
  // Needs to match the project name?
  get { return "Areas.Accounts"; }
 }

for my views in the accounts project to work?

I would really like the AreaName to still be Accounts, but for ASP.net MVC to look in the "Views\Areas\Areas.Accounts\" folder when its all munged into one project, rather than trying to find it within "View\Areas\Accounts\"

Thanks Mark

A: 

Forgive me if I'm way off, I've only recently started into MVC 2.0 (and I wasn't that far along with MVC 1.0 when I was pulled away to work on something else)...

I have the feeling that something in your code is auto-wiring for you, and when you changed the project name, whatever did the wiring isn't detecting/understanding the change. I assume somewhere the route look-up just isn't making the connection so you're forced to use the verbose name. Just a thought based on how many packages out there seem to exist just to handle wiring up events, actions, and everything else.