ASP.NET MVC Areas Application Using Multiple Projects

Posted by harrisonmeister on Stack Overflow See other posts from Stack Overflow or by harrisonmeister
Published on 2009-12-16T14:02:59Z Indexed on 2010/04/21 6:03 UTC
Read the original article Hit count: 916

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

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about asp.net-mvc-areas