gpt4 book ai didi

asp.net-mvc - CS0234 : Mvc does not exist in the System. Web命名空间

转载 作者:行者123 更新时间:2023-12-03 07:28:55 33 4
gpt4 key购买 nike

我根据 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 。现在我可以添加 Controller 、 View 等。所有引用都已正确设置。没有构建错误。但是在启动转换后的项目时,我遇到了编译错误。我在同一台机器上安装了 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.右键单击解决方案,然后单击“清理解决方案”

2.单击解决方案资源管理器中的'References'文件夹并选择问题引用(在您的情况下似乎是System.Web.Mvc),然后右键单击并单击'Properties'.

3.在属性窗口中,确保'Copy Local' 属性设置为'True'

这对我有用。希望对其他人有用

有用的注释:正如 @Vlad 在评论中提到的:

如果已设置为 True:

  1. 设置为假
  2. 再次将其设置为 True
  3. 重建

关于asp.net-mvc - CS0234 : Mvc does not exist in the System. Web命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14824228/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com