请参阅BundleConfig中的CSS文件生成WebGrease.dll错误

Luc*_*tos 9 asp.net-mvc bundle

当我把glyphicons.css我的BundleConfig中调用的特定CSS文件发生以下错误时

An exception of type 'System.IndexOutOfRangeException' occurred in WebGrease.dll but was not handled in user code

并且该文件存在于我的解决方案中的特定路径中,就像所有其他CSS文件一样.

有人遇到过这个问题吗?

    bundles.Add(new StyleBundle("~/Content/css").Include(
                "~/Content/css/bootstrap.css",
                "~/Content/css/uploadfyBoot/style.css",
                "~/Content/css/uploadfyBoot/jquery.fileupload.css",
                "~/Content/css/tipografia.css",
                "~/Content/css/glyphicons.css"
                ));
Run Code Online (Sandbox Code Playgroud)

如果我删除对glyphicons.css的引用它可以工作.

Mal*_*lik 26

我遇到过同样的问题 .我的项目是使用MVC5完成的.我尝试使用NuGet包管理器更新webGrease并重新打开解决方案并且它有效.


小智 5

如果您使用的是Visual Studio 2013:将这些新的引导文件添加到您的内容文件夹后,请更新BundleConfig.cs以反映您的更改.如果您仍然遇到该错误,则

以下步骤非常重要.

您从bootswatch.com下载的文件与2013项目不匹配的情况并不少见.我通过Microsoft ASP.NET MVCwebGrease使用Manage NuGet Packages 更新来修复我的错误.更新这两个后,关闭并重新打开您的解决方案.