This project is read-only.

Problem microsoft.sharepoint in a class library

Apr 26, 2011 at 9:50 AM
Edited Apr 26, 2011 at 9:58 AM


first of all great job with this tool, i just love it,

but i have some problem with microsoft.sharepoint assembly, i cannot add it in a class library, if i create a sharepoint class library with spsf and compile i have errors like this one :

 Error 11 The type or namespace name 'SPListItemCollection' could not be found (are you missing a using directive or an assembly reference?) C:\Projects\IServices\IPVService.cs 10 9 IServices

i use vs2010 MOSS 2007 SP2 and server 2008 R2 and spsf 3.1 all x64

please help, i'm stuck


Apr 27, 2011 at 8:50 PM

May it be possible, that the project is set to .net 4 Framework?

Can you attach a sample project where the error occurs?

Thanks in advance and thanks for your nice feedback! :-)

Apr 28, 2011 at 4:40 PM
Edited Apr 28, 2011 at 4:40 PM

No by default the target framework is set to 2.0,

when creating an SPSF artifact: sharepoint class library it automatically references Microsoft.SharePoint.dll, but when adding a sharepoint object it does not compile, more if i delete the reference and try to add it again i have the following error : incompatible reference (the sharepoint assembly full name) in order to add it you should to change the project's target to a compatible framework first,

i tried to change it but in vain.

also when referencing a sharepoint class library into another one, exemple (entities library--> serivces library) it compiles but the reference breakes down in vs, but it compiles anyway.

May 10, 2011 at 10:05 AM

Thank you for the more detailed description.

Unfortunately I am unable to reproduce the error, so the search is a little complicated without the VS solution.

May it be possible, that you created a SharePoint 2010 Solution with SPSF, though having SharePoint 2007 installed?
Actually the references should work anyway, because the assembly have the same public key and only differ in the version.

Could you please send me the solution for further investigation? I send you a PM with my email address. Thanks!

May 13, 2011 at 2:21 PM

thank you for your time and patience,

i've sent you a sample if it compiles for you that means it's an environement problem, hope not .

i'll be back with a wcf service and document sample... and more...

May 13, 2011 at 9:55 PM

We have checked your sample project. The target framework of the class library project must be v3.5.


I am eagerly waiting for your templates :-)

May 14, 2011 at 10:28 AM
Edited May 14, 2011 at 11:08 AM

thanks for you help, actually  it worked in the sample project but not in my actual project... wierd don't bother about that, i think it's an isolated problem due to assemblies in the gac and some other weird stuff, i'll try to clean up later and see the upcomming.

So let's say problem solved.

 and the add reference assembly problem was caused by the visual studio productivity tools, you cannot add assemblies in the project with this extension activated.

thanks, see you soon :))