c# - 错误无法从程序集“dotless.Core,版本=1.5.3.0”加载类型“dotless.Core.configuration.WebConfigConfigurationLoader”
问题描述
我正在使用 asp.net MVC 应用程序(.net framework 4.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")
System.TypeLoadException:'无法从程序集'dotless.Core,Version = 1.5.3.0,Culture = Neutral,PublicKeyToken = 96b446c9e63eae34'加载类型'dotless.Core.configuration.WebConfigurationLoader'。'
我搜索了这个错误并得到了dotless: Don't upgrade your dotless if you use System.Web.Optimization.Less已经遇到此问题的链接,但即使按照他们的建议,我仍然遇到同样的错误。
如果有人已经遇到此问题,请提供帮助。
解决方案
似乎System.Web.Optimization.Less
仍然希望WebConfigConfigurationLoader
在dotless.Core
程序集中,它不是dotless 1.6(它已被移动到新dotless.AspNet
程序集)。
我恢复到dotless 1.5.2,现在一切正常。
推荐阅读
- azure-data-factory - Devops arm模板,模板参数JToken类型无效
- mysql - mysql 与 ssl 使用 docker compose
- android - 访问 GATT 错误代码而不是 int
- python - python包元数据最佳实践
- angular - 错误类型错误:无法使用 {{myvideo[currentSlideIndex]?.title}} 在 Object.eval [as updateRenderer] 处读取未定义的属性“0”
- python - 使用python遇到整数时替换'='符号
- flutter - 如何在getx中将变量重置为默认值?
- c# - 我可以用脚本控制 Lighting2D 强度吗?(统一 C#)
- sql - 用连接到原始 SQL 表的表字符串事件填充的列
- html - 只有当内容高度适合屏幕高度时,我才能在固定位置设置一些东西?