缺少Asp.net单元测试参考System.Web.Mvc? [英] Missing reference to System.Web.Mvc in Asp.net Unit Test?

查看:144
本文介绍了缺少Asp.net单元测试参考System.Web.Mvc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近做了一些单元测试我的Asp.NET MVC应用程序,或者我想,这都跟我之类'System.Web.Mvc.Controller'在未引用的程序集的定义。你必须添加到程序集的引用'System.Web.Mvc,版本= 5.1.0.0,文化=中性。然后我试图添加到上面提到的引用,但只能够选择版本4.0.0.0,现在它告诉我,我的项目已经使用的版本5.1.0.0,这是一个更高的版本。怎么办?

I recently made some unit tests for my Asp.NET MVC application, or I tried to, it keep telling me "The type 'System.Web.Mvc.Controller' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral.' Then I tried to add a reference to the above mentioned, but was only able to choose version 4.0.0.0 and now it tells me that my project already uses version 5.1.0.0, which is a higher version. What to do?

感谢一大堆!

推荐答案

MVC 5从包装的NuGet用武之地。正如它与解决方案中的主要MVC Web项目。通过安装MVC的NuGet到你的测试项目,你应该是好去。

MVC 5 comes in from a NuGet package. Just as it did with the main MVC web project in your solution. Install MVC via NuGet into your Test project, and you should be good to go.

这篇关于缺少Asp.net单元测试参考System.Web.Mvc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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