Bundling with MVC4 not working after I publish to azure

前端 未结 9 2194
闹比i
闹比i 2021-02-08 14:52

Hi I am trying to bundle my scripts for my application. My debug is working and if I publish with the Web.debug every thing works fine. But when I publish with the Web.releas my

9条回答
  •  -上瘾入骨i
    2021-02-08 15:39

    really simple fix for this one:

    I had the following:

    bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css"));
    

    i also had a folder in my solution at:

    /Content/Css
    

    That was the problem, the stylebundle had the same name as a folder in my solution.

    Renamed the stylebundle to:

     bundles.Add(new StyleBundle("~/scripts/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css"));
    

    and (remember) to change where you referrence it, _Layout.cshmtl

    So to make this clear, if your stylebundle name is the same as an actual folder in your solution then you're gonna get this issue. Simply name it something different.

提交回复
热议问题