まず、このような自分のGlobal.asaxでヘルパーメソッドを用意:
private static void RegisterArea<T>(RouteCollection routes, object state) where T : AreaRegistration
{
AreaRegistration registration = (AreaRegistration)Activator.CreateInstance(typeof(T));
AreaRegistrationContext registrationContext = new AreaRegistrationContext(registration.AreaName, routes, state);
string areaNamespace = registration.GetType().Namespace;
if (!String.IsNullOrEmpty(areaNamespace))
registrationContext.Namespaces.Add(areaNamespace + ".*");
registration.RegisterArea(registrationContext);
}
今、あなたはこのようのApplication_Startで手動登録のため、このヘルパーメソッドを使用することができます。
//Replace AreaRegistration.RegisterAllAreas(); with lines like those
RegisterArea<FirstAreaRegistration>(RouteTable.Routes, null);
RegisterArea<SecondAreaRegistration>(RouteTable.Routes, null);
AreaRegistrationクラスがされています新しいエリアを追加するときにVisual Studioによって作成されたもので、エリア/エリア名のディレクトリで見つけることができます。