Question

My ASP.Net MVC 4 site runs great inside of Visual Studio 2013, however, in preperation for deployment, I tried to "publish" to my local instance of IIS, and my style/script bundles don't seem to be working.

I setup a new site in IIS:

IIS Config

And created a publish profile in visual studio:

Visual Studio Publish Profile

But it looks like something isn't executing correctly.

Working home page source sample (when running in visual studio)

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Home Page - My ASP.NET Application</title>

    <link href="/Content/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/Content/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/Content/css/animate.min.css" rel="stylesheet"/>
    <link href="/Content/css/lightbox.css" rel="stylesheet"/>
    <link href="/Content/css/syntax/shCore.css" rel="stylesheet"/>
    <link href="/Content/css/syntax/shThemeDefault.css" rel="stylesheet"/>
    <link href="/Content/css/color-default.css" rel="stylesheet"/>
    <link href="/Content/css/width-full.css" rel="stylesheet"/>
    <link href="/Content/css/style.css" rel="stylesheet"/>

    <link href="/Content/css/LESS/lba.less" rel="stylesheet"/>

    <script src="/Scripts/modernizr-2.6.2.js"></script>

Non working home page source sample (from IIS)

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Home Page - My ASP.NET Application</title>

    <link href="/Content/css?v=KKy3Sm_C-GIW_Hs_Kz3iGW2JCKsc0-x42GPtfoGzMKs1" rel="stylesheet"/>

    <link href="/Content/css/LESS?v=V3zOrniKjzcAwQn95ck_IGMcC8gvUmcHC3PpOi1mL_M1" rel="stylesheet"/>

    <script src="/bundles/modernizr?v=wBEWDufH_8Md-Pbioxomt90vm6tJN2Pyy9u9zHtWsPo1"></script>

As a bit of final info - the links/routes appear to be working (i.e. pages load when I click on the links).

Update 1

relevant portion of _Layout.cshtml

 @Styles.Render("~/Content/css")
 @Styles.Render("~/Content/css/LESS")
 @Scripts.Render("~/bundles/modernizr")

BundleConfig.cs

namespace Lubbock_Baseball_Academy
{
    public class BundleConfig
    {
        // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/respond.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/css/bootstrap.min.css",
                      "~/Content/css/font-awesome.min.css",
                      "~/Content/css/animate.min.css",
                      "~/Content/css/lightbox.css",
                      "~/Content/css/syntax/shCore.css",
                      "~/Content/css/syntax/shThemeDefault.css",
                      "~/Content/css/color-default.css",
                      "~/Content/css/width-full.css",
                      "~/Content/css/style.css"));

            bundles.Add(new ScriptBundle("~/bundles/theme").Include(
                       "~/Scripts/jquery-1.10.2.min.js",
                       "~/Scripts/jquery.cookie.js",
                       "~/Scripts/bootstrap.min.js",
                       "~/Scripts/jquery.mixitup.min.js",
                       "~/Scripts/lightbox-2.6.min.js",
                       "~/Scripts/holder.js",
                       "~/Scripts/app.js"));


            bundles.Add(new LessBundle("~/Content/css/LESS").Include(
                        "~/Content/css/LESS/*.less"));
        }
    }
}

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top