Skip to main content

ASP.NET MVC: SCRIPT1004: Expected ‘;’ after upgrading to jQuery 1.9

After upgrading our ASP.NET MVC 4 project to jQuery 1.9, our application started to fail with the following error message:
image
This is caused by the fact that starting from jQuery 1.9 a map file is added to the NuGet package. In my BundleConfig.cs I had the following:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
            "~/Scripts/jquery-1.*"));
The wildcard was being used to get the latest version of jQuery, however, this caused the map file to be included as well.

To solve this update the BundleConfig.cs to:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
            "~/Scripts/jquery-{version}.js"));