Tôi đã cố gắng tạo trang web ASP.NET MVC 4 đơn giản bằng chứng sử dụng các khu vực trong các dự án riêng biệt.ASP.NET MVC 4 Các khu vực trong các dự án riêng biệt không hoạt động (xem không tìm thấy)
Tôi đã cố gắng làm theo hướng dẫn: http://bob.archer.net/content/aspnet-mvc3-areas-separate-projects (Ứng dụng không hoạt động trong thư mục ảo ... Tôi sử dụng IIS). Tôi hy vọng có cách tốt hơn so với các thư mục ảo. Sau đó, tôi đã thử hướng dẫn này: http://forums.asp.net/t/1483660.aspx/1 Nhưng không có phần tử "AreasManifestDir" trong * .csproj của dự án khu vực (và gặp lỗi "Chế độ xem 'Chỉ mục' hoặc chủ của nó không được tìm thấy hoặc không có công cụ xem nào hỗ trợ tìm kiếm locations ")
Vẫn còn hỗ trợ trong ASP.NET cho MVC 4? Vì tôi thấy câu trả lời này có thể bị xóa trong tương lai: What are the pros and cons of Areas implemented as single projects vs multiple projects in asp.net mvc
Tôi chưa tìm thấy cách thực hiện nào cho MVC4.
Cấu trúc của giải pháp rất đơn giản:
Solution 'MvcAreasMultiProject'
Areas [Directory]
Admin [Project]
Models
Views
Controllers
Routes.cs [Examples]
MvcAreasMultiProject [MainProject]
- References Admin project
M.V.C
Routes.cs của dự án Admin:
namespace Admin
{
public class Routes : AreaRegistration
{
public override string AreaName { get { return "Admin"; } }
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Admin_Default",
"Admin/{action}/{id}",
new { controller = "Admin", action = "Index", id = "" },
new[] { "Admin.Controllers" }
);
}
}
}
Nhờ sự giúp đỡ!
http://elegantcode.com/2012/04/06/mvc-portable-areas/ – user960567