1

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).

superjos
  • 12,189
  • 6
  • 89
  • 134
  • This question I think it's related, but it has no answer http://stackoverflow.com/questions/6282431/moles-references-a-net-4-assembly-in-a-net-3-5-project . Probably this one too: http://stackoverflow.com/questions/5975474/moles-and-sharepoint-behaviour-types – superjos Oct 21 '11 at 15:26
  • I do not have (yet) an answer to this. But in order to make it work, I had to compile SharePoint 2010 behaviors for .NET 3.5 from Moles sources. Then: I removed the original .moles file and moled DLL references; I added the compiled SP behaviors DLL as any other reference from file system. – superjos Oct 24 '11 at 00:05
  • I withdrew my answer, because I simply don't know the answer to your question. I am going to research this. I'd rather not pollute the thread and add confusion. – Mike Christian Nov 03 '11 at 16:24

0 Answers0