MVC引用报错解决方法


开发工具与关键技术:Visual Studio 2015  MVCyin

作者:抽刀断水、刘

撰写时间:2019年  4月 29日

程序编译报了一大堆的错,发现是缺少引用,

但是明明引用了,后来打开引用,发现system.web.mvc这个引用打着叹号,如图
在这里插入图片描述

后来重新引用了本机的system.web.mvc,编译就不报错了,

但是运行他接着报“CS0234: 命名空间“System.Web.Mvc”中不存在类型或命名空间名称“Ajax”(是否缺少程序集引用?)”错误,如图

在这里插入图片描述

我老师说过就是设置System.Web.Mvc这个dll的属性“复制本地”设置为“true” 就OK。如图,

在这里插入图片描述

右击打开system.web.mvc的属性,然后在运行,就没错了。如果是英文的话,这个属性是Copy Local = True。

不过,有个问题就是,每次重新从SVN服务器上down下代码来,

或者revert这个项目都要这样操作一遍。

此错误原因是缺少了对应的dll库System.Windows.Forms.dll,即需要添加对System.Windows.Forms.dll库的引用。

方法是:右击项目名下面的那个“引用”
-> 添加引用 –> .NET –> 在“组建名称”中找到”System.Windows.Forms”并添加,即可解决此问题。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据提供的引用内容,这个错误通常是由于Spring MVC配置文件中缺少命名空间声明或缺少相应的xsd文件所致。解决此问题的方法如下: 1. 确认Spring MVC配置文件中是否声明了mvc命名空间。例如: ```xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> ``` 2. 确认Spring MVC配置文件中是否正确使用了mvc命名空间中的元素。例如: ```xml <mvc:default-servlet-handler /> ``` 3. 确认Spring MVC配置文件中是否正确引入了xsd文件。例如: ```xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> ``` 如果无法访问xsd文件,可以尝试使用本地文件系统中的xsd文件,例如: ```xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc file:///C:/spring-mvc.xsd"> ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值