asp.net - 错误的 System.Web.Mvc 更新

标签 asp.net nuget

我在 GAC 中添加了 System.Web.Mvc v4.0.0.0,所以我通过 nuget 使用“Install-Package Microsoft.AspNet.Mvc -Version 5.2.3”手动安装了 Mvc。

我现在已经安装了 System.Web.Mvc v5.2.3.0,
NuGet manager

和 GAC 中的 System.Web.Mvc v4.0.0.0
GAC

我在 Web.config 中有这个:

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

我构建并运行该项目,但出现下一个错误:

Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.



但是我已经配置并添加了 MVC v5.2.3.0 包。为什么会出现这个错误?

已解决
取消引用 System.Web.Mvc
引用 -> 右键单击​​ -> 管理 NuGet 包... -> 卸载 MVC -> 现在“安装”。

最佳答案

您看到的程序集来自 GAC .这并不一定意味着您在项目中使用它。如果要查看项目中安装的实际包,请右键单击该项目并单击“管理 NuGet 包”。

在“添加引用”屏幕上取消选中版本 4,然后使用包管理器控制台通过 NuGet 安装特定版本。确保您选择了正确的项目来安装包。

关于asp.net - 错误的 System.Web.Mvc 更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29882493/

相关文章:

c# - 从 IHttpHandler(通用处理程序)中的文件路径获取 URL

c# - 离线 Nuget 包

visual-studio-2015 - Visual Studio 无法识别已安装 NuGet 包的头文件

c# - 将 Amazon S3 Nuget 包含在 Xamarin Android 应用程序中会导致 FileNotFoundException

c# - 使用带有域服务的 ado.net Entity Framework 更新父表

c# - 从背后的 ASP.NET 代码与 iFrame 对话

msbuild - Nuget 将多个项目打包到具有所有外部依赖项的单个 Nuget 包中

.net - Azure 构建/发布管道将库推送到 nuget

asp.net - 使用代码动态加载 SSL

javascript - 动态显示所有页面的页面名称到index.html