2012-09-19 15 views
17

Tôi có pice mã sau đó chạy một cách hoàn hảo:Ký tự đại diện gói và rút gọn mới của {.NET} không hoạt động với các thư mục?

bundles.Add 
(
    new ScriptBundle("~/bundles/scripts") 
    .Include 
    (
     "~/Scripts/jquery-{version}.js" 
     ,"~/Scripts/jquery-ui-{version}.js" 
     ,"~/Scripts/jquery.unobtrusive*" 
     ,"~/Scripts/jquery.validate*" 
     ,"~/Scripts/fullcalendar-1.5.4/fullcalendar.js" 
     , "~/Scripts/DataTables-1.9.3/media/js/jquery.dataTables.js" 
    ) 
); 

Nhưng sau đó tôi muốn sử dụng {version} ký tự đại diện để sử dụng tất cả các tính năng của nó tiện lợi:

bundles.Add 
(
    new ScriptBundle("~/bundles/scripts") 
    .Include 
    (
     "~/Scripts/jquery-{version}.js" 
     ,"~/Scripts/jquery-ui-{version}.js" 
     ,"~/Scripts/jquery.unobtrusive*" 
     ,"~/Scripts/jquery.validate*" 
     , "~/Scripts/fullcalendar-{version}/fullcalendar.js" 
     , "~/Scripts/DataTables-{version}/media/js/jquery.dataTables.js" 
    ) 
); 

và BANG, ngoại lệ nó không hoạt động, tôi có làm gì sai không?

EDIT

thông tin Ngoại lệ: System.ArgumentException:

thư mục không tồn tại. tên Parameter: directoryVirtualPath

Stack:

[ArgumentException: Danh mục không tồn tại. Имя параметра: directoryVirtualPath]
System.Web.Optimization.Bundle.Include (String [] virtualPaths) 40
Aerostar.BundleConfig.RegisterBundles (bó BundleCollection) trong c: \ Users \ Denis \ Documents \ Visual Studio 2012 \ Projects \ Aerostar \ Aerostar \ App_Start \ BundleConfig.cs: 21
Aerostar.MvcApplication.Application_Start() trong c: \ Users \ Denis \ Documents \ Visual Studio 2012 \ Projects \ Aerostar \ Aerostar \ Global.asax. cs: 24

[HttpException (0x80004005): Thư mục không tồn tại. Имя параметра: directoryVirtualPath]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode (HttpContext bối cảnh, HttpApplication ứng dụng) 9.859.725
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS (IntPtr appContext, HttpContext bối cảnh, MethodInfo [] xử lý) 118
System.Web.HttpApplication.InitSpecial (HttpApplicationState nhà nước, MethodInfo [] xử lý, IntPtr appContext, HttpContext ngữ cảnh) 172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance (IntPtr appContext, HttpContext ngữ cảnh) 336
System.Web.Hosting.PipelineRuntime.InitializeApplication (IntPtr appContext) +296

[HttpException (0x80004005): Thư mục không tồn tại. Имя параметра: directoryVirtualPath]
System.Web.HttpRuntime.FirstRequestInit (HttpContext ngữ cảnh) 9.873.912 System.Web.HttpRuntime.EnsureFirstRequestInit (HttpContext ngữ cảnh) 101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate (IIS7WorkerRequest wr, HttpContext bối cảnh) +254

+0

Sẽ rất hữu ích nếu bất cứ ai đọc điều này để biết * ngoại trừ * gì. =) –

+0

Xin lỗi, tôi đã chỉnh sửa câu hỏi – Lu4

Trả lời

27

Đó là chính xác, hiện tại biểu thức {version} chỉ được hỗ trợ như một phần của tệp, không được sử dụng trong khi thực hiện đi bộ thư mục.Đây là điều chúng tôi sẽ xem xét trong bản sửa lỗi trong một phiên bản tương lai.

Tôi đã gửi một sự cố cho this here on codeplex.

Vui lòng bỏ phiếu nếu đây là điều bạn cảm thấy mạnh mẽ về việc chúng tôi khắc phục.