Alex F
Alex F

Reputation: 43331

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?

Upvotes: 3

Views: 2035

Answers (3)

SHug
SHug

Reputation: 688

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.

Upvotes: 1

CodeCaster
CodeCaster

Reputation: 151700

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

Upvotes: 4

Daniel A. White
Daniel A. White

Reputation: 191037

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

Upvotes: 7

Related Questions