Reputation: 4740
When I put a specific CSS file called glyphicons.css
in my BundleConfig occurs the following error
An exception of type 'System.IndexOutOfRangeException' occurred in WebGrease.dll but was not handled in user code
and the file exist in my solution in the specific path, like all the anothers CSS files.
Someone has faced this problem yet ?
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"
));
If I remove the reference to glyphicons.css it works.
Upvotes: 9
Views: 11727
Reputation: 8431
I had this problem. My version of webgrease.dll was the latest so there was nothing to update. A closer look at my BundleConfig file revealed the following.
bundles.Add(new ScriptBundle("~/Content/css").Include(
"~/Content/css/cssfile1.css",
"~/Content/css/cssfile2.css",
));
While creating my css bundles I'd accidentally copy-pasted a script bundle code block. The following fixed it:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/css/cssfile1.css",
"~/Content/css/cssfile2.css",
));
In short, I swapped "ScriptBundle" for "StyleBundle". Works fine now.
Upvotes: 4
Reputation: 3690
I had the same issue . My project is done using MVC5. I tried updating the webGrease using NuGet package manager and reopened the solution and it worked .
Upvotes: 27
Reputation: 531
if you are using Visual studio 2013:
After adding those new bootstrap files into your content folder, Update BundleConfig.cs to reflect your changes.
The following step is important if you are still getting that error.
Its not uncommon that the files that you downloaded from bootswatch.com mismatch with your 2013 project. I fixed my error by updating by Microsoft ASP.NET MVC and webGrease using Manage NuGet Packages.
After you update these two, close and re-open your solution.
Upvotes: 5