I am using Tom DuPonts MvcBundler, following his guide here: http://www.tomdupont.net/2012/03/configuring-bundles-in-mvc-4.html
I have this in my configuration file
<add bundlePath="~/js/shared" minify="false">
<directories>
<add directoryPath="~/Scripts/Shared" searchPattern="*.js"></add>
</directories>
</add>
This is causing this error.
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 59: @Html.JsBundle("~/js/types")
Line 60: @Html.JsBundle("~/js/libraries")
Line 61: @Html.JsBundle("~/js/shared") <
Delete
minify="false"
or upgrade to
minify="true"
Allows a program to work correctly.
Is there a way not to use minification for a set of files with this extension?
Full stack trace
[NullReferenceException: Object reference not set to an instance of an object.]
System.Object.GetType() +0
System.Web.Optimization.DefaultBundleBuilder.BuildBundleContent(Bundle bundle, BundleContext context, IEnumerable`1 files) +381
System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext context) +282
System.Web.Optimization.Bundle.GetBundleUrl(BundleContext context, Boolean includeContentHash) +66
System.Web.Mvc.HtmlHelperExtensions.ReferenceBundle(HtmlHelper helper, String bundlePath, TagBuilder baseTag, String key) +142
ASP._Page_Views_Shared_Layouts_Default__Layout_cshtml.Execute() in Web\Views\Shared\Layouts\Default\_Layout.cshtml:61
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +125
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +196
System.Web.WebPages.WebPageBase.Write(HelperResult result) +89
System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +233
System.Web.WebPages.WebPageBase.PopContext() +291
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +380
System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +33
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +263
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +240
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +28
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
Edit:
After updating the library to version 2.2.0, I get this error
Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper<dynamic>'
does not contain a definition for 'CssBundle' and no extension method
'CssBundle' accepting a first argument of type
'System.Web.Mvc.HtmlHelper<dynamic>' could be found (are you missing a
using directive or an assembly reference?)
Line 19: <link rel="icon" href="/Content/images/favicon.ico">
Line 20:
Line 21: @Html.CssBundle("~/css/bootstrap")