locked
Why is Client Object Model restricted to .net 3.5? RRS feed

  • Question

  • Hi,

    I am just beginnig with development for / against Sharepoint 2010. It's a little disappointing that one is restricted to use .net 3.5 framework. And in the case of the Client Object Model I don't understand why. Why is it not possible to use the Sharepoint assembly in my .net 4.0 application. Normally it is possible to use a .net 3.5 assembly in a .net 4.0 project.

    Can you explain it?

    Regards,
    Jerma

     

    Thursday, November 25, 2010 9:03 PM

Answers

  • The SharePoint 2010 object model only supports .NET 3.5 and this is by design. SharePoint 2010 was released around the time that .NET 4.0 was and SharePoint 2010 was not tested or intended to work with .NET 4.0 and as such this is not supported by Microsoft. In addition, there are differences between 3.5 and 4.0, notably workflow, that would have required a significant redesign of a lot of SharePoint functionality to support .NET 4.0. Effectively, it is baked into the dll's not to support .NET 4.0. So you are correct that 'generally' it is possible to use a 3.5 assembly with 4.0, but this is not the case with SharePoint 2010. With that said, you could use REST or web services to interact with SharePoint in a .NET 4.0 project instead of the Client Object Model if you have to use .NET 4.0.

    I hope this helps,

    Craig

    • Marked as answer by Jerma Friday, November 26, 2010 1:44 AM
    • Edited by Craig Lussier Saturday, November 27, 2010 8:41 PM
    Thursday, November 25, 2010 9:33 PM
  • I am not aware of any official plan to support .NET 4.0 nor have I heard anything that would suggest this. As MOSS 2007 was based on .NET 2.0, SharePoint 2010 is based on .NET 3.5 - and I suspect the next version of SharePoint, when ever that happens may be based on .NET 4.0. With no official word, I will not speculate, so for SharePoint 2010, .NET 3.5 it is.

    Cheers,

    Craig

    • Marked as answer by Jerma Friday, November 26, 2010 1:45 AM
    Thursday, November 25, 2010 10:42 PM

All replies

  • The SharePoint 2010 object model only supports .NET 3.5 and this is by design. SharePoint 2010 was released around the time that .NET 4.0 was and SharePoint 2010 was not tested or intended to work with .NET 4.0 and as such this is not supported by Microsoft. In addition, there are differences between 3.5 and 4.0, notably workflow, that would have required a significant redesign of a lot of SharePoint functionality to support .NET 4.0. Effectively, it is baked into the dll's not to support .NET 4.0. So you are correct that 'generally' it is possible to use a 3.5 assembly with 4.0, but this is not the case with SharePoint 2010. With that said, you could use REST or web services to interact with SharePoint in a .NET 4.0 project instead of the Client Object Model if you have to use .NET 4.0.

    I hope this helps,

    Craig

    • Marked as answer by Jerma Friday, November 26, 2010 1:44 AM
    • Edited by Craig Lussier Saturday, November 27, 2010 8:41 PM
    Thursday, November 25, 2010 9:33 PM
  • Thank you, Craig. Now I understand the background of this design decision a little better.You helped a lot!

    But it's a very strange decision. After all the Client Object Model even works with Silverlight 4...!

    Do you know of any future plans to make net 4.0 projects possible in the future?

    • Marked as answer by Jerma Friday, November 26, 2010 1:44 AM
    • Unmarked as answer by Jerma Friday, November 26, 2010 1:44 AM
    Thursday, November 25, 2010 10:13 PM
  • I am not aware of any official plan to support .NET 4.0 nor have I heard anything that would suggest this. As MOSS 2007 was based on .NET 2.0, SharePoint 2010 is based on .NET 3.5 - and I suspect the next version of SharePoint, when ever that happens may be based on .NET 4.0. With no official word, I will not speculate, so for SharePoint 2010, .NET 3.5 it is.

    Cheers,

    Craig

    • Marked as answer by Jerma Friday, November 26, 2010 1:45 AM
    Thursday, November 25, 2010 10:42 PM
  • What is your source of information that 4.0 cannot be used with the SharePoint CLIENT object model?  I heard that it can be. I've searched the Internet and can't get any relevant hits [except this this page   :-)  ].
    Rick - MSFT
    Friday, December 3, 2010 8:44 PM
  • When I replied to this string I did search and most articles I found said to target the 3.5 framework - eg http://msdn.microsoft.com/en-us/library/ee857094.aspx that states "By default, Visual Studio creates a project that targets .NET Framework 4, but you must target .NET Framework 3.5. From the list at the upper part of the File Open dialog box, select .NET Framework 3.5". I will stand corrected Rick as I done additional research and in this MSDN article regarding WPF states that 4.0 can be used http://msdn.microsoft.com/en-us/library/ff630937.aspx. I've found this to be conflicting information. So, is this situational? Is there any official Microsoft literature that outlines different project types where 4.0 can be used with the Client Object Model? Please advise as my primary goal it to provide the most correct information in the forums. If you can update this thread, I'd appreciate it. I look forward to your reply.

    Thanks,

    Craig


    Senior Systems Engineer / SharePoint Architect | MSDN Profile | SharePoint Task Force
    Friday, December 3, 2010 10:39 PM
  • I tried the first sample application in the first of the two articles you linked, but I set it to .NET Framework 4.0 instead of 3.5.  It compiled and worked just fine. So I think the first article is erroneous. I will file a bug to get it fixed.

    (One little annoyance, however:  If you choose Framework 4.0 when selecting the VS project type and choose Console Application, when VS creates the project it switches your Framework chose to .NET Framework 4.0 Client Profile.  You have to change it back to plain 4.0. The client profile version does not include the System.Web.dll on which the 2 SharePoint client dlls are dependent. )


    Rick - MSFT
    Saturday, December 4, 2010 1:10 AM