Neeraj Kumar Gupta
Neeraj Kumar Gupta

Reputation: 2363

ERROR Could not load type 'dotless.Core.configuration.WebConfigConfigurationLoader' from assembly 'dotless.Core, Version=1.5.3.0

I am working with asp.net MVC application(.net framework 4.6.1), I want to use the bundle for .less files so I register the bundles in BundleConfig file as follows

public static void RegisterBundles(BundleCollection bundles)
{
   //other bundles are here ..
    bundles.Add(new LessBundle("~/Content/less").Include("~/Content/*.less"));
}

in order to use the less I already installed the following packages from package manager

dotless.Core.1.6.0.1
dotless.AspNetHandler.1.6.0.1
System.Web.Optimization.Less.1.3.4

this is my "_Layout.cshtml"

<!DOCTYPE html>
<html style=" height: 100%;
  margin: 0;">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
    @Styles.Render("~/Content/less")
    @Scripts.Render("~/bundles/modernizr")
</head>
<body style="padding:0;margin:0;" class="col-12 h-100">
    <div class="h-100 border">
        @RenderBody()
    </div>
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)
</body>
</html>

now when I am running the application, getting following error at @Styles.Render("~/Content/less")

System.TypeLoadException: 'Could not load type 'dotless.Core.configuration.WebConfigConfigurationLoader' from assembly 'dotless.Core, Version=1.5.3.0, Culture=neutral, PublicKeyToken=96b446c9e63eae34'.'

enter image description here

I googled for this error and got dotless: Don’t upgrade your dotless if you use System.Web.Optimization.Less link who already encountered with this issue, but I still getting same error even followed the their suggestion.

Please help if some one already faced this issue.

Upvotes: 3

Views: 1449

Answers (1)

Ted Nyberg
Ted Nyberg

Reputation: 7391

Seems System.Web.Optimization.Less still expects WebConfigConfigurationLoader to be in the dotless.Core assembly, which it isn't as of dotless 1.6 (it's been moved to the new dotless.AspNet assembly).

I reverted to dotless 1.5.2 and everything works fine now.

Upvotes: 3

Related Questions