Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0' or one of its dependencies

后端 未结 7 941
名媛妹妹
名媛妹妹 2021-02-18 13:56

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         


        
7条回答
  •  逝去的感伤
    2021-02-18 14:07

    I expanded references and when I hovered over System.Web.Mvc, I observed that its version is 4.0.0.1. And its path is strangely C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies. My packages.config showed the the corresponding nuget package is Microsoft.AspNet.Mvc.5.2.3. The reference seems to be wrong. So removed the reference from the project. Then uninstalled the nuget package using the following command.

    uninstall-package Microsoft.AspNet.Mvc -force

    Note force in the command.

    Then I reinstalled it by the following command

    install-package Microsoft.AspNet.Mvc -version 5.2.3.0

    Now I ensured that the referenced dll is correctly pointing to nuget one

    D:\Vivek\Code1\Sept17\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll

    Now when I ran I discovered similar problem with System.Web.Webpages.Razor(Microsoft.AspNet.WebPages nuget) and System.Web.Razor(Microsoft.AspNet.Razor nuget). So I removed those as well and reinstalled the corresponding nuget packages.

    Then it finally worked.

提交回复
热议问题