我正在使用asp.net MVC应用程序(.net Framework4.6.1),我希望为.less文件使用捆绑包,因此我在BundleConfig文件中注册了这些包,如下所示
public static void RegisterBundles(BundleCollection bundles)
{
//other bundles are here ..
bundles.Add(new LessBundle("~/Content/less").Include("~/Content/*.less"));
}为了使用less,我已经从包管理器安装了以下软件包
dotless.Core.1.6.0.1
dotless.AspNetHandler.1.6.0.1
System.Web.Optimization.Less.1.3.4这是我的_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>现在,当我运行应用程序时,在@Styles.Render("~/Content/less")上得到以下错误
'dotless.Core.configuration.WebConfigConfigurationLoader‘System.TypeLoadException:“无法从程序集加载类型dotless.Core、Version=1.5.3.0、Culture=neutral、PublicKeyToken=96b446c9e63eae34”。

我搜索了这个错误,并得到了无网点:如果你使用System.Web.Optimization.Less,就不要升级你的清白链接谁已经遇到了这个问题,但我仍然收到同样的错误,甚至遵循他们的建议。
如果有人已经面临这个问题,请帮忙。
发布于 2018-10-17 09:03:27
似乎System.Web.Optimization.Less仍然期望WebConfigConfigurationLoader在dotless.Core程序集中,而无标记1.6 (它已被移到新的dotless.AspNet程序集中)并不是这样。
我又回到了(无标记的1.5.2 ),现在一切都很好。
https://stackoverflow.com/questions/50209049
复制相似问题