Is asp.net MVC2 included in .net 4.0 framework?

丶灬走出姿态 提交于 2019-11-27 17:08:17

问题


I've installed .net 4 in the server.
Now I don't know if I must install the MVC 2 for VS2008 or what because I got this error:

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


回答1:


VS 2010 comes with MVC 2, but it's not a part of the .NET Framework proper. This means that if you go download the .NET Framework 4 redistributable, it will not include the MVC 2 runtime.

But since MVC is bin-deployable, this is fine. Your application - when deployed to a .NET 3.5 SP1 or .NET 4 server - will just copy System.Web.Mvc.dll to its /bin folder, and everything will run as expected. MVC runs just fine in Medium Trust.

To do a server wide install you need to download AspNetMVC2_VS2008.exe from here, rename the .exe to .zip and inside the mvcruntime sub-folder you'll find the AspNetMVC2.msi file.

Then you have to run:

msiexec /i AspNetMVC2.msi /l*v .\mvc.log MVC_SERVER_INSTALL="YES"



回答2:


by default the System.Web.Mvc.dll is not included when you compile an MVC 2 project; you have to change the setting "Copy Local" to True on the Reference properties to get the file in your /bin



来源:https://stackoverflow.com/questions/2633504/is-asp-net-mvc2-included-in-net-4-0-framework

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