Bundleconfig json configured but bundles not being created in asp net core 3 1


ASP.NET is a popular programming used for building web applications. It provides a framework for dynamic websites and web services. One of the key features of ASP.NET is its ability to bundle and minify files such as CSS and JavaScript. However, sometimes developers may encounter issues where the bundle configuration is set in the BundleConfig.json file, but the bundles are not being in ASP.NET Core 3.1.

Possible Causes

There could be several reasons why the bundles are not being created in ASP.NET Core 3.1. Let's explore some of the common causes and their solutions.

1. Incorrect BundleConfig.json Configuration

The first thing to check is the BundleConfig.json file. Ensure that the bundles are defined correctly with the file paths. Each bundle have a unique name and include the necessary CSS or JavaScript files. Here's an example of a BundleConfig.json file:

  "bundles": {
    "styles": {
      "outputFileName": "wwwroot/css/styles.min.css",
      "inputFiles": [
    "": {
      "outputFileName": "wwwroot/js/scripts.min.js",
      "inputFiles": [

2. Missing BundleConfig.json Reference

Ensure that the BundleConfig.json file is referenced correctly in the Startup.cs file. In the ConfigureServices method, add the following code:

services.AddMvc().AddRazorPagesOptions(options =>
    options.Conventions.ConfigureFilter(new IgnoreAntiforgeryTokenAttribute());
}).AddMvcOptions(options =>
    options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());


Make sure to replace “bundles” with the appropriate section name in your BundleConfig.json file.

3. Incorrect Bundle Tag Usage

Check if the bundle tag helpers are used correctly in your Razor views. The bundle tag helpers are used to render the bundled CSS or JavaScript files. Here's an example of how to use the bundle tag helper:

Make sure to replace “styles” and “scripts” with the appropriate bundle names defined in your BundleConfig.json file.

4. Missing BundleTransformer NuGet Packages

If you are using BundleTransformer to bundle and minify your static files, ensure that you have installed the necessary NuGet packages. The packages depend on the file types you are bundling. For example, if you are bundling CSS files, you need to install the BundleTransformer.Core and BundleTransformer.SassAndScss packages. Check the BundleTransformer documentation for the correct packages and versions.


When bundles are not being created in ASP.NET Core 3.1 despite correct configuration in the BundleConfig.json file, it is important to check for common causes such as incorrect configuration, missing references, incorrect tag helper usage, and missing NuGet packages. By addressing these issues, you should be able to successfully create bundles in your ASP.NET Core 3.1 application.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents