This project has moved. For the latest updates, please go here.

Bundled "file" does not exist in the server

May 15, 2015 at 11:02 AM
I deployed my project to a single server.
It was working perfectly locally, in both ways, bundling or not
(setting debug=true or false in the web.config)

In the server though, bundle transformer is apparently doing its job, generating the bundled link but that link does not exist in the server, I get an error 404 when try to access the link.

If I set debug=true in my web.config in the server, the correct files are being listed and it works, which makes me assuming this is not a code issue, maybe some configuration or installation missing.

That's my web.config in the server:
    <sectionGroup name="bundleTransformer">
          <section name="core" type="BundleTransformer.Core.Configuration.CoreSettings, BundleTransformer.Core" />
          <section name="yui" type="BundleTransformer.Yui.Configuration.YuiSettings, BundleTransformer.Yui" />
    </sectionGroup>
(...)
<bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd">
        <core>
            <css defaultMinifier="YuiCssMinifier">
                <translators>
                    <add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="true" />
                </translators>
                <postProcessors>
                    <add name="UrlRewritingCssPostProcessor" type="BundleTransformer.Core.PostProcessors.UrlRewritingCssPostProcessor, BundleTransformer.Core" useInDebugMode="false" />
                </postProcessors>
                <minifiers>
                    <add name="YuiCssMinifier" type="BundleTransformer.Yui.Minifiers.YuiCssMinifier, BundleTransformer.Yui" />
        </minifiers>
                <fileExtensions>
                    <add fileExtension=".css" assetTypeCode="Css" />
                </fileExtensions>
            </css>
            <js defaultMinifier="YuiJsMinifier">
        <translators>
          <add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="true" />
        </translators>
        <minifiers>
          <add name="YuiJsMinifier" type="BundleTransformer.Yui.Minifiers.YuiJsMinifier, BundleTransformer.Yui" />
        </minifiers>
        <fileExtensions>
          <add fileExtension=".js" assetTypeCode="JavaScript" />
        </fileExtensions>
      </js>
        </core>
    </bundleTransformer>
That's my BundleConfig.cs, RegisterBundle method:
           BundleResolver.Current = new CustomBundleResolver();
            
            var nullBuilder = new NullBuilder();
            var styleTransformer = new StyleTransformer();
            var scriptTransformer = new ScriptTransformer();
            var nullOrderer = new NullOrderer();
            
            var companycss = new CustomStyleBundle("~/bundlesCSSJS/Company.css");
            companycss.Include(
                "~/Scripts/bootstrap/css/bootstrap.css",
                "~/Scripts/bootstrap/css/bootstrap-theme.css",
                "~/Scripts/yamm/yamm.css",
                "~/Scripts/magiczoomplus.v4.5/magiczoomplus.css",
                "~/App_Themes/Company/template.css");
            companycss.Builder = nullBuilder;
            companycss.Transforms.Add(styleTransformer);
            companycss.Orderer = nullOrderer;
            bundles.Add(companycss);
That's what my Master Page have:
<head>
    (...)
    <%= Styles.Render("~/bundlesCSSJS/Company.css")%>
</head>
That's the result when debug=true, everything works fine here:
<link href="/Scripts/bootstrap/css/bootstrap.css?bundleVirtualPath=%7e%2fbundlesCSSJS%2fCompany.css" rel="stylesheet">
<link href="/Scripts/bootstrap/css/bootstrap-theme.css?bundleVirtualPath=%7e%2fbundlesCSSJS%2fCompany.css" rel="stylesheet">
<link href="/Scripts/yamm/yamm.css?bundleVirtualPath=%7e%2fbundlesCSSJS%2fCompany.css" rel="stylesheet">
<link href="/Scripts/magiczoomplus.v4.5/magiczoomplus.css?bundleVirtualPath=%7e%2fbundlesCSSJS%2fCompany.css" rel="stylesheet">
<link href="/App_Themes/Company/template.css?bundleVirtualPath=%7e%2fbundlesCSSJS%2fCompany.css" rel="stylesheet">
That's the result when debug=false, but that link does not exist:
<link href="/bundlesCSSJS/Company.css?v=yZ_YnEzfdtMlo2Z-00g_2PX_o_NL_7mB_fEgJfWGg1k1" rel="stylesheet">
Any idea why this is happening?
Have you seen that before?
Does the server require some internet access? Some extra dll?
By the way, I am not using LESS or SASS.

Thank you,
Coordinator
May 15, 2015 at 11:16 AM
Try to remove a file extension from the bundle virtual path (instead ~/bundlesCSSJS/Company.css try ~/bundlesCSSJS/CompanyStyles).

And remove the following lines:
companycss.Builder = nullBuilder;
companycss.Transforms.Add(styleTransformer);
Because CustomStyleBundle already includes instances of StyleTransformer and NullBuilder classes.
May 15, 2015 at 1:32 PM
Thanks for your reply.
It worked locally, so I will give it a try on the server later today.