我有以下完美运行的代码:
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"
)
);
但后来我想使用{version}通配符来使用它的所有漂亮功能:
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(String [] virtualPaths)+40
Aerostar.BundleConfig.RegisterBundles(BundleCollection包)中 c:\ Users \ Denis \ Documents \ Visual Studio 2012 \项目\ AEROSTAR \ AEROSTAR \ App_Start \ BundleConfig.cs:21个
Aerostar.MvcApplication.Application_Start()in c:\ Users \ Denis \ Documents \ Visual Studio 2012 \项目\ AEROSTAR \ AEROSTAR \ Global.asax.cs中:24[HttpException(0x80004005):目录不存在。 Имяпараметра: directoryVirtualPath]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext的 上下文,HttpApplication app)+9859725
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr的 appContext,HttpContext上下文,MethodInfo []处理程序)+118
System.Web.HttpApplication.InitSpecial(HttpApplicationState状态, MethodInfo [] handlers,IntPtr appContext,HttpContext context)+172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr的 appContext,HttpContext context)+336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr的 appContext)+296[HttpException(0x80004005):目录不存在。 Имяпараметра: directoryVirtualPath]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context)+9873912 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest) wr,HttpContext context)+254
答案 0 :(得分:29)
这是正确的,目前{version}表达式仅作为文件的一部分受支持,在执行目录遍历时不使用它。这是我们将在未来版本中修复的内容。
我为this here on codeplex提交了一个问题。
如果您对我们有很强的理解,请将其投票赞成。