gpt4 book ai didi

c# - 错误无法从程序集 'dotless.Core,版本 = 1.5.3.0 加载类型 'dotless.Core.configuration.WebConfigConfigurationLoader'

转载 作者:行者123 更新时间:2023-11-30 15:54:33 26 4
gpt4 key购买 nike

我正在使用 asp.net MVC 应用程序(.net framework 4.6.1),我想将 bundle 用于 .less文件,所以我在 BundleConfig 中注册了 bundle 文件如下

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") 出现以下错误

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

我用谷歌搜索了这个错误并得到了 dotless: Don’t upgrade your dotless if you use System.Web.Optimization.Less已经遇到此问题的链接,但即使按照他们的建议我仍然遇到同样的错误。

如果有人已经遇到过这个问题,请提供帮助。

最佳答案

似乎 System.Web.Optimization.Less 仍然期望 WebConfigurationLoaderdotless.Core 程序集中,但它不是dotless 1.6(已移至新的 dotless.AspNet 程序集)。

我恢复到 dotless 1.5.2,现在一切正常。

关于c# - 错误无法从程序集 'dotless.Core,版本 = 1.5.3.0 加载类型 'dotless.Core.configuration.WebConfigConfigurationLoader',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50209049/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com