Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot reference moq.dll in C# 2010

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?

like image 483
Alex F Avatar asked Feb 02 '26 03:02

Alex F


2 Answers

Change your project not to use the .NET 4 client profile in your project properties.

You want the other one from this image.

enter image description here

like image 145
Daniel A. White Avatar answered Feb 04 '26 16:02

Daniel A. White


Your project is targeting the .NET 4 Client Profile, change it to 'regular' .NET 4 and it'll work.

like image 27
CodeCaster Avatar answered Feb 04 '26 18:02

CodeCaster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!