CS0234:Mvc 在 System.Web 命名空间中不存在 [英] CS0234: Mvc does not exist in the System.Web namespace

查看:14
本文介绍了CS0234:Mvc 在 System.Web 命名空间中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我根据专业 ASP.NET 3.5 MVC 第 13 章,由 Scott Hanselmen、Phil Haack 和 Rob Conery,由 Wiley Publishing, Inc. (ISBN: 978-0-470-38461-9).我也关注了这个博客.现在我可以添加控制器、视图等.所有引用都设置正确.没有构建错误.但是在启动转换后的项目时,我遇到了编译错误.我在同一台机器上安装了 mvc3.我什至改变了对那个的引用.它仍然抱怨.你能帮忙吗?谢谢.

I converted a ASP.net 4 webform project to Asp.net MVC4 according to Chapter 13 of the Professional ASP.NET 3.5 MVC, by Scott Hanselmen, Phil Haack, and Rob Conery, Published by Wiley Publishing, Inc. (ISBN: 978-0-470-38461-9). I also followed this blog. Now I can add Controllers, Views, etc. All the references are set properly. No build errors. But upon launching the converted project, I got compilation errors. I have mvc3 installed on the same machine. I even changed the reference to that. It still complain. Could you help? Thanks.

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:UsersJonDocumentsVisual Studio 2012ProjectsCMTAppsBranches3.0Web.config    Line: 111 

推荐答案

当您将 Web 应用程序部署到服务器时可能会发生此问题,因此您必须检查您是否已经安装了 MVC3.

This problem can happen when you deploy your web application to a server, so you must check if you already installed MVC3.

检查文件夹 C:Program FilesMicrosoft ASP.NETASP.NET MVC 3 是否存在.

Check if the folder C:Program FilesMicrosoft ASP.NETASP.NET MVC 3 exists.

如果它不存在,您需要从 http://www.microsoft.com/en-us/download/details.aspx?id=1491

If it doesn't exist, you need to install it from http://www.microsoft.com/en-us/download/details.aspx?id=1491

如果您不想安装,您可以在 bin 文件夹中本地添加所有 DLL 并添加对它们的引用,如果您在服务器上托管而不部署 ASP.NET 网页或 MVC3,则此工作正常.

If you wont to install you can add all DLLs locally in bin folder and add references to them this work fine if you host on server don't deploy ASP.NET Web Pages or MVC3.

这篇关于CS0234:Mvc 在 System.Web 命名空间中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆