我的项目文件夹“Scripts”有问题。出于某种原因,当我在 VS 2012 中运行该程序时,它给了我一个异常(exception):
Invalid file name for file monitoring: 'c:\users\user\documents\visual studio 2012\Projects\project1\project\Scripts'. Common reasons for failure include: - The filename is not a valid Win32 file name. - The filename is not an absolute path. - The filename contains wildcard characters. - The file specified is a directory. - Access denied.
无法加载其中的 .js 文件。为什么会这样? (顺便提一下,我尝试重新启动并清除了 Temp 文件夹)。
编辑: 这是抛出异常的代码。
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
最佳答案
我使用 Basic 模板创建了新项目。它解决了这个问题。 (以前的项目模板是“空”)。 :)
关于javascript - MVC 4 找不到 "Scripts"文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18512644/