【问题标题】:Exception thrown in WebGrease.dll after updating to bootstrap 5 MVC更新到引导程序 5 MVC 后在 WebGrease.dll 中引发异常
【发布时间】:2021-10-05 18:05:08
【问题描述】:

我遇到的问题是,将引导程序更新到 v5.0.2 后在 WebGrease.dll 中引发异常 (NullReferenceException),而引导程序 v3 和 v4 工作正常。

以下代码来自共享布局:

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)

BundleConfig 中的以下代码:

bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                  "~/Scripts/bootstrap.js"));

bundles.Add(new StyleBundle("~/Content/css").Include(
                  "~/Content/bootstrap.css",
                  "~/Content/Site.css"));

从 nuget 管理器检查了 WebGrease,它已更新。

【问题讨论】:

    标签: .net visual-studio bootstrap-4 nuget bootstrap-5


    【解决方案1】:

    找到了。 https://stackoverflow.com/a/45056631/4179709 将捆绑配置更改为新的捆绑对象。不是 bootstrap.js 的 ScriptBundle 对象

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-06
      • 2018-04-14
      • 2014-11-18
      • 1970-01-01
      • 1970-01-01
      • 2018-05-05
      相关资源
      最近更新 更多