无法加载文件或程序'System.Web.Mvc,版本= 3.0.0.0“或它的一个依赖 [英] Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0' or one of its dependencies

查看:114
本文介绍了无法加载文件或程序'System.Web.Mvc,版本= 3.0.0.0“或它的一个依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用软件包管理器控制台下面的命令添加Ninject在MVC项目:

 安装封装Ninject -version 3.0.1.10
安装封装Ninject.Web.Common -version 3.0.0.7
安装封装Ninject.MVC3 -Version 3.0.0.6

当我运行应用程序,我得到的错误是这样的:


  

无法加载文件或程序'System.Web.Mvc,版本= 3.0.0.0,文化=中立,
      公钥= 31bf3856ad364e35或它的一个依赖。
      找到的程序集清单定义不匹配程序集引用。 (异常来自HRESULT:0x80131040)



解决方案

更​​新应用程序Web.config文件

务必使这些变化在应用程序web.config文件,而不是在浏览文件夹中的web.config文件。

 <&运行GT;
     < assemblyBinding的xmlns =瓮:架构 - 微软COM:asm.v1>
         < dependentAssembly>
             < assemblyIdentity名称=System.Web.Mvc公钥=31bf3856ad364e35/>
             < bindingRedirect oldVersion =1.0.0.0-5.0.0.0NEWVERSION =5.0.0.0/>
         < / dependentAssembly>
      < / assemblyBinding>
 < /运行>

I am adding Ninject in MVC project using the following commands in Package Manager Console:

Install-Package Ninject -version 3.0.1.10
Install-Package Ninject.Web.Common -version 3.0.0.7
Install-Package Ninject.MVC3 -Version 3.0.0.6

When I run the application, I get error like this:

Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, 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)

解决方案

Update the Application web.config File

Be sure to make these changes in the app web.config file, not the web.config file in the Views folder.

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

这篇关于无法加载文件或程序'System.Web.Mvc,版本= 3.0.0.0“或它的一个依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆