0

I'm baffled. I have spent well over 8 hours on this. I have built the Bootstrap project, the default ASP.Net project, The default MVC 4 project. They bundle and work. I cannot get it into my live project (MVC 4). In the page source, it is pointing at a bundle, but the bundle does not seem to exist. I have forced it to bundle in the debug environment using BundleTable.EnableOptimizations = true in Global.asax.cs. I have also published it to the local host as a release to work this out. It doesn't seem like anyone else has encountered this problem. I have removed wild cards. I have verified all files exist.

This is BundleConfig.cs

bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
            "~/Content/themes/base/css/trap.css",
            "~/Content/themes/base/css/calendar.css",
            "~/Content/themes/base/css/calendar_green.css",
            "~/Content/themes/base/css/jquery-ui.css",
            "~/Content/themes/base/css/reset.css",
            "~/Content/themes/base/css/tables.css",
            "~/Content/themes/base/css/media.css"
            ));

bundles.Add(new StyleBundle("~/Content/css").Include(
            "~/Content/css/css1.css"
            ));

bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
            "~/Scripts/modernizr-2.6.2.min.js"));
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
            "~/Scripts/jquery-1.9.1.js"));

bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
            "~/Scripts/jquery-ui.js"));
bundles.Add(new ScriptBundle("~/bundles/indexjs").Include(
             "~/Scripts/customform.js",
             "~/Scripts/main.js",
             "~/Scripts/calendar.js",
             "~/Scripts/index.js"));

These are in _Layout.cshtml

<meta name="viewport" content="width=device-width" />
@Styles.Render("~/Content/themes/base/css")
@Styles.Render("~/Content/css")

@Scripts.Render("~/bundles/modernizr")
   }
}
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
@Scripts.Render("~/bundles/indexjs")

This is what is in the page:

<link href="/Content/themes/base/css?v=7SpkiWgU-0qwm8o4vYF5hDEB6L_DnS5xvUSEa1JLYW81" rel="stylesheet"/>
<link href="/Content/css?v=fh8XEHnJaCFRna_3Cjrz3hjgz5VDfBkXTaNJ1ign4pk1" rel="stylesheet"/>

<script src="/bundles/jquery?v=UmEFuwJBr5PmaadGOBwoWrIxakg6oVbTduk0Gdne4ko1"></script>
<script src="/bundles/jqueryui?v=u5Tft1k7a-ZOfnV1Fz5TM1T_Rv33WbgFF-rZ8VWBtX01"></script>
<script src="/bundles/indexjs?v=1ATJu4VPSoZ_HPVcPlj-Te73BaXgxachLoR5Vxg0te81"></script>

I am baffled. I am open to any suggestion. It just does not work.

Erik Philips
  • 53,428
  • 11
  • 128
  • 150
Miguelito
  • 302
  • 3
  • 11
  • 1
    A couple of details I'm not clear on; does it work locally when you force optimizations? Also, what is the error you're getting? Do the bundle URLs return 404 or a blank response? – Paul Keister Jul 08 '13 at 23:29
  • No, it does not work locally, in Visual Studio or in wwwroot called as localhost. There is no error, just no markup. Notice that the links are there for the css (2) and js (3), so that part is correct, there is just nothing at those links/references. – Miguelito Jul 09 '13 at 12:41
  • Whoops... was adding... One reason I published it was to see if the bundled css and js were put in minimized files I could see that were part of the publishing package. They are not. Even in the sample projects that worked, the were no minimized files. Apparently that is done at run time by the IIS. Unfortunately that makes it invisible... – Miguelito Jul 09 '13 at 12:47
  • Ah, you ask an interesting question. There is no 404 error, but then there isn't when a css file of js file is missing. Really, I have been looking for css files, but I should be able to tell if js files are missing. The console would report that. I could just put in an alert to run at document.ready(). If it runs, then the js bundle is working. I'll test that, but that still doesn't say where the css bundle is. – Miguelito Jul 09 '13 at 13:04
  • Son of a gun, an alert() added to jquery-1.9.1.js showed on the screen, so apparently the js bundle is working, just not the css bundle. I'm going to try to impliment the default style bundle. – Miguelito Jul 09 '13 at 13:11
  • 2
    GOT THE ANSWER! http://stackoverflow.com/questions/15540528/bundling-scripts-are-not-getting-rendered?rq=1 .. You cannot name the bundle the same name as the directory the files are in. – Miguelito Jul 09 '13 at 13:15

0 Answers0