2

I have a web application MVC5. For a production website we set compilatoin debug=false in the web.config. To test this I also did this on my local development machine. This works in production and locally. But now I have to develop further so i need the setting back to compilation debug=true. When i set this value and run the application my javascript is stil being bundled. I have also tried BundleTable.EnableOptimization = false, but no effect.

For more information on bundling, visit here

        public static void RegisterBundles(BundleCollection bundles)
        {
            BundleTable.EnableOptimizations = false;
            bundles.Add(new ScriptBundle("~/bundles/main").Include(
                    "~/Scripts/at/main.js",
                    "~/Scripts/at/GridAT.js",
                    "~/Scripts/at/responsive.js",
                    "~/Scripts/at/domainat.js",
                    "~/Scripts/at/fineuploaderat.js",
                    "~/Scripts/at/entitysearch.js",
                    "~/Scripts/at/atquiz.js",
                    "~/Scripts/at/jQueryExtendAT.js",
                    "~/Scripts/at/widget.js"
            ));

In web.config

<compilation targetFramework="4.5" debug="true"/>

In Layout:

 <!-- 1. Script: recourses -->
    @Scripts.Render(Url.Content("~/bundles/jquery"))
    @Scripts.Render(Url.Content("~/bundles/jqueryui"))
    @Scripts.Render(Url.Content("~/bundles/jqueryvalidation"))
    @Scripts.Render(Url.Content("~/bundles/resources"))
    @Scripts.Render(Url.Content("~/bundles/fineuploader"))
    @Scripts.Render(Url.Content("~/bundles/highcharts"))
    @Scripts.Render(Url.Content("~/bundles/mustache"))
    <script type="text/javascript" src="@Url.Content("~/scripts/tiny_mce/tiny_mce.js")"></script>
    @Scripts.Render(Url.Content("~/bundles/signalr"))

I have also checked with a coworker who does not have this issue on his computer

Bartvandee
  • 289
  • 3
  • 19
  • You don't explain what you are looking for, nor in your CSHTML you have no reference to `@Scripts.Render(Url.Content("~/bundles/main") ` Could you please change your question to explain 1. What you are experiencing 2. what you are expecting to happen. – Qpirate Aug 24 '17 at 07:28
  • Hello, The issue is that javascript is still being bundles even though web.config setting and BundleTable settings are telling my app not to. I am exxpecting to have bundling disabled with the above settings. – Bartvandee Aug 24 '17 at 07:31
  • Have a look at this question: (its nearly a duplicate of your question) https://stackoverflow.com/questions/11944745/asp-net-bundles-how-to-disable-minification – Qpirate Aug 24 '17 at 07:56
  • for each bundle in bundletable.bundles , bundle.Transforms.Clear() while compilation is in debug mode. https://stackoverflow.com/questions/11944745/asp-net-bundles-how-to-disable-minification – Amit Kumar Singh Aug 24 '17 at 07:57
  • implemented: foreach (var bundle in BundleTable.Bundles) { bundle.Transforms.Clear(); }, but no effect – Bartvandee Aug 24 '17 at 08:23
  • The Transforms.clear() did disabled minification, but not Bundling – Bartvandee Aug 24 '17 at 08:30

1 Answers1

0

After searching for the rest of the day I decided to remove the project from disk and get it from TFS. After that it worked properly. Thank you all for responding.

Bartvandee
  • 289
  • 3
  • 19