Why Moles picks up SharePoint.Behaviors for .NET v4.0 when all the rest is v3.5?

389 views Asked by At

I have a ClassLibrary accessing SharePoint 2010 object model as part of a bigger SP 2010 Sandbox solution. All projects target .NET v3.5 (not client profile). Then there's a ASP.NET WebApplication project used to test the ClassLibrary - still .NET v3.5.

I'm trying to use Microsoft Moles in order to mock SPContext.Current - which I already know and have used - and I run into this problem: upon each build, the moles framework will always pick the Microsoft.SharePoint.Behaviors DLL for runtime v4.0.30319 in order to copy it into MolesAssemblies. Instead for Microsoft.SharePoint.Moles it picks v2.0.50727.

Incidentally those are just the DLLs found in C:\Program Files\Microsoft Moles\MolesAssemblies\Microsoft.SharePoint\14.0.0.0__71e9bce111e9429c. But I remember during Moles install that both v4.0 and v3.5 moles were created.

Is there a way to tell Moles to build and/or copy the DLL for runtime v3.5? Or is there a special place were I should build and store them, in order to let Moles pick them up?

Somehow I also had a look at the temporary options file created during build (...\obj\Debug\Moles\moles.args) and the last options are actually /clrversion:v2.0.50727 /clrversion2 /targetframeworkversion:v3.5.

Environment: Windows 7 64bit, VS 2010 SP1, Moles v0.94.51023.0 - .NET v4.0.30319 (Moles only install, no Pex).

0

There are 0 answers