I created a new MVC project (simple template), run it and everyting was ok. But then I updated NuGet packages and when I run my project then the error showed up:
System.NullReferenceException: Object reference not set to an instance of the object
In the debug mode this error comes from this line:
@Scripts.Render("~/bundles/bootstrap")
I didn't touch anything in my code, just updated NuGet packages. My bundle looks standard, like this:
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
I have Bootstrap installed and all files are in proper directories (css in Content and js in Scripts).
Interesting thing is that when I changed ScriptBundle to Bundle then it started working. Anyways I don't think it's a proper solution, do you have any ideas how to make it work with standard ScriptBundle?