Could not load file or assembly 'System.Web.Mvc' or one of its dependencies

夙愿已清 提交于 2019-11-30 09:26:47

I had this problem when deploying to a server which ran MVC2, the files which will need to be included in the build are:

Microsoft.Web.Infrastructure.dll
System.Web.Helpers.dll
System.Web.Mvc.dll
System.Web.Razor.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.dll
System.Web.WebPages.Razor.dll

Phil Haack has done a good post here (for how to solve if you run into this problem when deploying)

http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx

Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0,..."

Your application is using MVC3, but according to your own comment, the server has MVC2 (2.0.50217.0).

Right Click to Project -> Manage Nuget Packages for solution than update

Microsoft.AspNet.Mvc and Microsoft.Net.Compilers

If you have rights to do so, you can download and install MVC3 on your webserver.

Right click on System.Web.Mvc in your reference folder and make sure that copy local is set to true. That should add System.web.mvc to your bin folder and it should correct the problem.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!