我根据 Scott Hanselmen、Phil Haack 和 Rob Conery 出版的 Professional ASP.NET 3.5 MVC 第 13 章,将 ASP.net 4 webform 项目转换为 Asp.net MVC4,由 Wiley Publishing, Inc. 出版(ISBN:978- 0-470-38461-9)。我也关注了这个blog http://www.britishdeveloper.co.uk/2011/05/convert-web-forms-mvc3-how-to.html。现在我可以添加控制器、视图等。所有引用都已正确设置。没有构建错误。但是在启动转换后的项目时,我遇到了编译错误。我在同一台机器上安装了 mvc3。我什至改变了对此的引用。它仍然抱怨。你能帮忙吗?谢谢。
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Source Error:
Line 109: <namespaces>
Line 110: <add namespace="System.Web.Helpers"/>
Line 111: <add namespace="System.Web.Mvc"/>
Line 112: <add namespace="System.Web.Mvc.Ajax"/>
Line 113: <add namespace="System.Web.Mvc.Html"/>
Source File: c:\Users\Jon\Documents\Visual Studio 2012\Projects\CMT\Apps\Branches\3.0\Web.config Line: 111
我遇到了同样的问题,我已经解决了:
1.右键单击解决方案并单击'Clean Solution'
2.Click 'References'
解决方案资源管理器中的文件夹并选择问题参考(在您的情况下似乎是 System.Web.Mvc),然后右键单击并单击'Properties'
.
3.在属性窗口中,确保'Copy Local'
属性设置为'True'
这对我有用。希望它对其他人有用
有用的注释:正如@Vlad 在评论中提到的:
如果它已经设置为 True:
- 设置为假
- 再次设置为 True
- Rebuild
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)