gpt4 book ai didi

c# - 查找多个 System.Web.Mvc 引用的原因

转载 作者:行者123 更新时间:2023-11-30 21:58:47 24 4
gpt4 key购买 nike

使用 dotPeek 检查 Web 项目主程序集的引用,我看到:

System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

Visual Studio 中的项目引用仅显示版本 5.2.3.0。我还搜索了引用项目的 .csproj 文件。

Manage NuGet Packages 仅显示 v5.2.3 of Microsoft.AspNet.Mvc。

搜索 packages 文件夹只在 Microsoft.AspNet.Mvc.5.2.3\lib\net45 下找到 v5.2.30128.0。

gacutil/l System.Web.Mvc 显示版本 3.0.0.0 和 4.0.0.0。

我使用 dotPeek 的引用层次结构查看了其他引用,但没有找到旧版本。

根据回复,我检查了 Web.config;这已经存在了:

  <dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>

我还检查了其他 Web.configs 是否存在版本冲突。

此外,我尝试在 System.Web.Mvc 引用属性中将特定版本设置为 True。这没有什么区别。

是否需要多个版本?如果没有,如何找到并删除旧版本的源?

最佳答案

尝试将此添加到您的 web.config

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

这基本上测试了您的应用程序,对于应用程序中引用的 System.Web.MVC 的任何版本(从 1-5.2.3)改为使用 5.2.3.0。很可能您有一个仍在寻找特定版本 5.0 的引用。这让我一直对 JSON.net 感到厌烦。

关于c# - 查找多个 System.Web.Mvc 引用的原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29858044/

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