Mocking and .NET Framework Client Profile

I found an interesting small gotcha with Visual Studio today.

I whipped up a quick Hello World Console application and added references for Rhino Mocks and Moq.  However, neither would compile:

I then realized that the Console application, by default, uses the .NET Framework Client profile.  You can read more about it  here – basically it is a stripped down version of the .NET Framework to allow for a smaller footprint on WinForms, Services, and Console applications.  You can see in properities:

 

Apparently, both Mocking frameworks use System.Web, which is not part of the Client profile.  Simply switching the target framework to .Net Framework 4.0 solved the issue.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: