Search code examples
asp.netasp.net-mvclibsassbundletransformer

BundleTransformer LibSass Could not be found error


I want to use BundleTransformer. I've followed all the steps stated in the docs, but still don't work.

I've installed:

  • BundleTransformer.SassAndScss
  • BundleTransformer.Autoprefixer
  • LisSassHost
  • LibSassHost.Native.win-x64
  • JavaScriptEngineSwitcher.V8

Here is my config:

<bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd">
    <autoprefixer cascade="true">
        <jsEngine name="V8JsEngine" />
        <browsers>
            <add conditionalExpression="&gt; 5%" />
            <add conditionalExpression="last 2 versions" />
        </browsers>
    </autoprefixer>
    <sassAndScss>
        <includePaths>
            <add path=""></add>
        </includePaths>
    </sassAndScss>
    <core>
        <css defaultPostProcessors="UrlRewritingCssPostProcessor,AutoprefixCssPostProcessor">
            <translators>
                <add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="false" />
                <add name="SassAndScssTranslator" type="BundleTransformer.SassAndScss.Translators.SassAndScssTranslator, BundleTransformer.SassAndScss" />
            </translators>
            <postProcessors>
                <add name="UrlRewritingCssPostProcessor" type="BundleTransformer.Core.PostProcessors.UrlRewritingCssPostProcessor, BundleTransformer.Core" useInDebugMode="false" />
                <add name="AutoprefixCssPostProcessor" type="BundleTransformer.Autoprefixer.PostProcessors.AutoprefixCssPostProcessor, BundleTransformer.Autoprefixer" useInDebugMode="true" />
            </postProcessors>
            <minifiers>
                <add name="NullMinifier" type="BundleTransformer.Core.Minifiers.NullMinifier, BundleTransformer.Core" />
            </minifiers>
            <fileExtensions>
                <add fileExtension=".css" assetTypeCode="Css" />
                <add fileExtension=".sass" assetTypeCode="Sass" />
                <add fileExtension=".scss" assetTypeCode="Scss" />
            </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" />
            </minifiers>
            <fileExtensions>
                <add fileExtension=".js" assetTypeCode="JavaScript" />
            </fileExtensions>
        </js>
    </core>
</bundleTransformer>

And registering of V8 engine:

// JsEngineSwitcherConfig.js
public class JsEngineSwitcherConfig {
    public static void Configure(JsEngineSwitcher engineSwitcher) {
        engineSwitcher
            .EngineFactories
            .AddV8();

        engineSwitcher.DefaultEngineName = V8JsEngine.EngineName;
    }
}

// Global.asax
JsEngineSwitcherConfig.Configure(JsEngineSwitcher.Instance);

After some fixed troubles, my last error is this: LibSass error

I Think this has something to do with:

For correct working of the LibSass Host requires msvcp140.dll assembly from the Visual C++ Redistributable for Visual Studio 2015.

But, I don't know how to require that dll.

Or indeed I don't know where the real problem is, I'll appreciate if anyone can help please.


Solution

  • Well, after trying a little, I just installed LibSassHost.Native.win-x86, and it worked.

    Now I have the two packages x64 and x86, everything is working fine.