无法在 C# 2010 中引用 moq.dll
我从 www.code.google.com/p/moq 下载了 Moq.4.0.10827 并尝试将对 Moq.4.0.10827\NET40\Moq.dll 的引用添加到 Visual Studio 2010 C# 项目中。尝试构建此项目时,我看到此警告:
引用的程序集“Moq,Version=4.0.10827.0,Culture=neutral, PublicKeyToken=69f491c39445e920,processorArchitecture=MSIL”无法 被解决,因为它依赖于“System.Web, 版本=4.0.0.0,文化=中立,PublicKeyToken=b03f5f7f11d50a3a” 不在当前目标框架内 “.NETFramework,版本=v4.0,配置文件=客户端”。请删除引用 到不在目标框架中的程序集或考虑重新定位 您的项目。
Moq 命名空间无法识别,构建失败。如何解决这个问题?
I donwloaded Moq.4.0.10827 from www.code.google.com/p/moq and trying to add reference to Moq.4.0.10827\NET40\Moq.dll to Visual Studio 2010 C# project. Trying to build this project, I see this warning:
The referenced assembly "Moq, Version=4.0.10827.0, Culture=neutral,
PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL" could not
be resolved because it has a dependency on "System.Web,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
which is not in the currently targeted framework
".NETFramework,Version=v4.0,Profile=Client". Please remove references
to assemblies not in the targeted framework or consider retargeting
your project.
Moq namespace is not recognized, and build fails. How can this be fixed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将您的项目更改为不在项目属性中使用 .NET 4 客户端配置文件。
您想要这张图片中的另一张。
Change your project not to use the .NET 4 client profile in your project properties.
You want the other one from this image.
您的项目针对的是 .NET 4 Client Profile,将其更改为“常规”.NET 4 即可正常工作。
Your project is targeting the .NET 4 Client Profile, change it to 'regular' .NET 4 and it'll work.
您的 C# 项目基于 .NET 4 Client Profile。您需要将其定位到完整的 .NET 4 配置文件,因为它需要能够引用 System.Web。
Your C# project is based against the .NET 4 Client Profile. You need to target it to the full .NET 4 profile as it needs to be able to reference System.Web.