asp.net-coreasp.net-core-3.0

Bundler & Minifier generating "Object reference not set to an instance of an object" error


I trying bundle and minify my CSS and JS files in ASP.NET Core 3.0 with BuildBundlerMinifier.Core. Also Installed Bundler & Minifier extension for Visual Studio 2019.

When I try Debug the project, it working correctly without error but when I rebuild it, I'm getting the following error;

Object reference not set to an instance of an object

enter image description here

I don't get an error when restart Visual Studio and I can debug the project again but If I rebuild it again, I'm getting the error.

It's bundleconfig.json file

[
  {
    "outputFileName": "wwwroot/assets/css/style.bundle.min.css",
    "inputFiles": [
      "wwwroot/assets/plugins/global/plugins.bundle.css",
      "wwwroot/assets/css/style.bundle.css",
      "wwwroot/assets/css/skins/header/base/light.css",
      "wwwroot/assets/css/skins/header/menu/light.css",
      "wwwroot/assets/css/skins/brand/light.css"
    ],
    "sourceMap": false,
    "sourceMapRootPath": null
  }
,
{
  "outputFileName": "wwwroot/assets/js/scripts.min.js",
  "inputFiles": [
    "wwwroot/assets/plugins/global/plugins.bundle.js",
    "wwwroot/assets/js/scripts.js",
    "wwwroot/assets/js/pages/dashboard.js",
    "wwwroot/content/js/mobil-detect.js",
    "wwwroot/content/js/lazy-img.js",
    "wwwroot/content/js/ziyaretci.js"
  ]
}
]

enter image description here

Visual Studio, Bundler & Minifier extension, BuildBundlerMinifier and BuildBundlerMinifier.Core are up to date How can I fix it ?


Solution

  • The project has BuildBundlerMinifier and BuildBundlerMinifier.Core. I removed BuildBundlerMinifier from nuget and now it works.