无法加载文件或程序集 'WebGrease,版本 = 1.5.1.25624 - 或任何其他版本

Could not load file or assembly 'WebGrease, Version=1.5.1.25624 - Or any other version

我在这些问题中发现了同样的问题

Could not load file or assembly 'WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies

Could not load file or assembly 'WebGrease' one of its dependencies. The located assembly's manifest definition does not match the assembly reference

Could not load file or assembly 'WebGrease' or one of its dependencies

None 这些答案似乎有所帮助。

我有一个 WebForms 项目 运行 .Net 4; 不是 MVC。

我正在使用 Microsoft Web 优化及其依赖项添加捆绑和缩小。

我收到错误消息:

Could not load file or assembly 'WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

我试过换web grease的版本,也试过网页优化。 None 正在工作。

这些图片显示了我当前的参考资料、网络配置和其他信息:

网络润滑脂:

网站优化

网络配置

包配置

我正尝试在我的母版页中使用以下代码来应用我的包:

<asp:PlaceHolder runat="server">
    <%: System.Web.Optimization.Scripts.Render("~/JS/Global") %>
    <%: System.Web.Optimization.Styles.Render("~/CSS/Global") %>
</asp:PlaceHolder>

任何人都知道我如何让它工作?我不介意使用旧版本的库;只是似乎无法找到不会导致问题的问题。

难道是NewtonSoft.Json的版本?

更新

所以无论我安装什么版本,我都会收到完全相同的消息,一直到版本。似乎无法确定问题出在哪里

为什么将 Newtonsoft.Json 版本绑定重定向到版本 7.0.0.0。您的包中没有这样的版本。删除该重定向或添加适当版本的 Newtonsoft.Json.