.NET Core2.0 bundleconfig.json not working

You have to remove the "wwwroot" part in the urls. "wwwroot" is the root folder where your application is running. Now it will search the files in "...wwwroot/wwwroot/js..." instead of "...wwwroot/js...".


I could not get this working and learned that there is more to the problem at the present time.

By default none of the Bundling & Minifying stuff is installed in a dotnet core razor pages project.

Supposedly, you can can check your settings by right-clicking the bundleconfig.json in Visual Studio Solution Explorer. But that doesn't show anything in my project.

I finally found a Visual Studio Add-in.

Bundler & Minifier -- manual

Instead I installed a manual bundler & minifier -- which is written by the same author (Mads Kristensen) as the Nuget pkg from above. https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier

That's a Visual Studio extension and after you install it, you can right-click any css or js file and you'll get menu which allows you to minify them "manually". bundle file

Enable bundle on build...

That option will warn you that it is going to install a Nuget package. I didn't do that yet.

I also unchecked that option [Produce Output Files] and then selected it again (checked) and when I did that another file was created in my solution underneath the bundleconfig.json named bundleconfig.json.bindings. That file contains just one line:

produceoutput=true

It's odd that it wasn't there previously. I know that file didn't exist previously, because git told me there are untracked files and mentioned that file.

To test if there is a problem in studio or something, I created a brand new dotnet Core 2.x Razor Pages project, then immediately deleted the min.css and tried to build it again but it woudln't ever build again.

Update All Bundles I built again after the .bindings file was added, but the bundles still weren't built. I then noticed that I have another option under the [Build] menu but I'm not sure if that is the Bundling & Minifying plugin I installed so you'll have to consider that when looking for this solution.

update all bundles

You can also check your settings in the Visual Studio [Tools...Options...] menu:

Tools and Options You can see that the Bundler & Minifier has the Product Output files option set to true in my project (even though it still isn't working).

Actually, I read that bottom sentence a little more closely and I noticed that it says, "actively listens to input file changes" so I went and changed my site.css and noticed that the value was indeed updated in the site.css.

Make A Change, Change It Back

The odd thing is when / if you delete your site.min.css then it doesn't seem to get regenerated at any time. I guess now if you do that, you could make a change and change it back and the min file would be created.

I tested that: deleted site.min.css then made a change and the file was gen'd again. It's just odd that the build doesn't fire this functionality.


I tired it for Nuget Package Manager but it didn't work, then uninstall that ,

Solved with:

open Nuget Package Manager console,

Install-Package BuildBundlerMinifier -Version 2.8.391 

and Rebuild solution again. it works for me.