2012-09-19 42 views
17

我有下面的代碼PICE它運行完美:新的.NET功能包和縮小{版本}通配符不適用於目錄?

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" 
    ) 
); 

但後來我想使用{版本}通配符使用它的所有漂亮的功能:

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" 
    ) 
); 

和BANG,異常,它不工作,我做錯了什麼?

編輯

異常信息: System.ArgumentException:

目錄不存在。 參數名:directoryVirtualPath

堆棧:

[ArgumentException的:目錄不存在。 Имяпараметра: directoryVirtualPath]
System.Web.Optimization.Bundle.Include(字符串[] virtualPaths)40個
Aerostar.BundleConfig.RegisterBundles(BundleCollection束)在 C:\用戶\丹尼斯\文件\ Visual Studio中 2012 \ Projects \ Aerostar \ Aerostar \ App_Start \ BundleConfig.cs:21
Aerostar.MvcApplication.Application_Start() c:\ Users \ Denis \ Documents \ Visual Studio 2012 \ Projects \ Aerostar \ Aerostar \ Global.asax。 cs:24

[HttpException(0x80004005):目錄不存在。 Имяпараметра: directoryVirtualPath]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext的 上下文,HttpApplication的應用)9859725個
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr的 appContext,HttpContext的上下文中,MethodInfo的[]處理程序)118
System.Web.HttpApplication.InitSpecial(HttpApplicationState狀態, MethodInfo的[]處理程序,IntPtr的appContext,HttpContext的上下文中)172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr的 appContext,HttpContext的上下文中)336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)+296

[HttpException(0x80004005):目錄不存在。 Имяпараметра: directoryVirtualPath]
System.Web.HttpRuntime.FirstRequestInit(HttpContext的上下文)9873912 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext的上下文) 101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest WR,HttpContext的上下文)+254

+0

這可能會有助於任何人讀這個知道*什麼*例外。 =) –

+0

對不起,我編輯了這個問題 – Lu4

回答

27

這是正確的,目前{version}表達式僅作爲文件的一部分被支持,它在進行目錄散步時未被使用。這是我們將在未來版本中修復的內容。

我對this here on codeplex提交了一個問題。

如果這是您強烈要求我們解決的問題,請將其投票。

相關問題