3
votes

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?

3

3 Answers

4
votes

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

7
votes

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

1
votes

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.