Taritsyn / BundleTransformer

Bundle Transformer - a modular extension for System.Web.Optimization (also known as the Microsoft ASP.NET Web Optimization Framework).
Apache License 2.0
130 stars 19 forks source link

Getting IIS “There's a duplicate error” after installing BundleTransformer.UglifyJs #31

Closed michaeluskov closed 5 years ago

michaeluskov commented 5 years ago

I want to use UglifyJS's minifcation instead of Microsoft's standard one, so I've installed BundleTransformer.UglifyJs NuGet package. But after installing that package and rebuilding my app I get an IIS error with code 0x800700b7 and error text There's a duplicate of "bundleTransformer/core".

As I see, two new sections appeared in Web.config:

  <configSections>
        <sectionGroup name="bundleTransformer">
            <section name="core" type="BundleTransformer.Core.Configuration.CoreSettings, BundleTransformer.Core" />
        <section name="uglify" type="BundleTransformer.UglifyJs.Configuration.UglifySettings, BundleTransformer.UglifyJs" /></sectionGroup>
    </configSections>

And

      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
      </dependentAssembly>
<bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd">
        <core>
            <css>
                <translators>
                    <add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="false" />
                </translators>
                <postProcessors>
                    <add name="UrlRewritingCssPostProcessor" type="BundleTransformer.Core.PostProcessors.UrlRewritingCssPostProcessor, BundleTransformer.Core" useInDebugMode="false" />
                </postProcessors>
                <minifiers>
                    <add name="NullMinifier" type="BundleTransformer.Core.Minifiers.NullMinifier, BundleTransformer.Core" />
                </minifiers>
                <fileExtensions>
                    <add fileExtension=".css" assetTypeCode="Css" />
                </fileExtensions>
            </css>
            <js>
                <translators>
                    <add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="false" />
                </translators>
                <minifiers>
                    <add name="NullMinifier" type="BundleTransformer.Core.Minifiers.NullMinifier, BundleTransformer.Core" />
                <add name="UglifyJsMinifier" type="BundleTransformer.UglifyJs.Minifiers.UglifyJsMinifier, BundleTransformer.UglifyJs" /></minifiers>
                <fileExtensions>
                    <add fileExtension=".js" assetTypeCode="JavaScript" />
                </fileExtensions>
            </js>
        </core>
    </bundleTransformer>    

I can't find any other pieces of Web.config containing bundleTransformer or core. What's wrong with my webapp's configuration?

Taritsyn commented 5 years ago

Hello, Michael!

Why is the following block of code outside the runtime section?

      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
      </dependentAssembly>
michaeluskov commented 5 years ago

I don't know, it was inserted the automatically after NuGet package installation. Should it be inside?

Taritsyn commented 5 years ago

Should it be inside?

Yes.

michaeluskov commented 5 years ago

It didn't help.

BTW IIS doesn't like this line:

<section name="core" type="BundleTransformer.Core.Configuration.CoreSettings, BundleTransformer.Core" />

Taritsyn commented 5 years ago

See the Web.config file from sample project.