Saturday, 19 June 2010

SharePoint 2010 and .NET 4: confused?

I have seen a few queries on the Technet forums recently regarding the use of ASP.NET 4 and SharePoint, an example being this post here.

There appears to be some confusion (myself included) around whether or not ASP.NET 4 is supported for both MOSS and SharePoint 2010 - in short, the answer is that it is not currently supported in either product.

Whilst it is possible to use ASP.NET 3.5 in MOSS by making some modifications to the SharePoint site web.config (instructions for doing that in MOSS here; SP2010 uses 3.5 by default), this is unfortunately not the case with version 4.

The reason? ASP.NET 4 uses a new version of the Common Language Runtime (CLR). Whilst .NET 2.0, 3.0 and 3.5 all used version 2.0 of the CLR, .NET 4 uses version 4. I'm not entirely sure what happened to version 3. There is a decent post on stack overflow with further details.

For those that are wondering, the fact that .NET 3.0 and 3.5 do not show up as options within IIS is also related to the CLR version. IIS knows about that - it does not know about framework and compiler versions and the aspnet_isapi.dll from the version 2.0 is used for version 2.0 through 3.5 for this reason. This post explains that in more detail. Does that mean we will get a new option in IIS for .NET 4? You bet, due to the use of CLR v4.

So does that mean we are destined to use .NET 3.5 for the lifetime of SharePoint 2010? Not necessarily. Aside from the possibility of Microsoft adding support for version 4 in a future service pack, those using ASP.NET Web forms in separate virtual directories will still be able to use .NET 4 so long as said virtual directories are in a separate application pool. I have confirmed this is the case with Microsoft in this post, and believe this to be the case for SharePoint 2010.

I hope that helps clarify things a little.

Subscribe to the RSS feed

Follow me on Twitter

Follow my Networked Blog on Facebook

8 comments:

  1. Thanks I was slightly confused about where we stood in regards to .net 4 support and sharepoint.

    Thanks Chap

    ReplyDelete
  2. Thank you, was confused, now ok

    ReplyDelete
  3. Thanks Benjamin. Unfortunately trying to access the Microsoft link results in a Not Authorised error - You are not authorized to perform this action. Will be very grateful if you can post the details here please.

    Thanks

    ReplyDelete
  4. For anyone who can't access the MS link, here is the response from the forum:

    ============

    Wednesday, June 02, 2010 9:34 AMAdam ZhuMicrosoft, Moderator



    0
    Vote As Helpful
    Dear Partner,

    Thank you for posting in our Partner Online Technical Community. This is Adam, and I will continue helping you.

    From your problem description, I understand that you would like to know if ASP.NET 4 supports MOSS 2007 so that forms applications on MOSS 2007 could be upgraded to ASP.NET 4. If there has been any misunderstanding, please let me know.

    I performed a deep research on Microsoft resources but am sorry to inform you that there is no official article indicating this availability currently. However, I sent an inquiry to SharePoint development team and got a reply that ASP.NET 4 indeed supports MOSS 2007.

    Meanwhile, if you encounter any break-fix problems while installing ASP.NET 4 on MOSS 2007 server, please post to the link below:

    This forum is for partner support for ASP.NET
    http://social.microsoft.com/Forums/en-US/partnerdevaspnet/threads
    Best regards,

    Adam Zhu
    Partner Online Technical Community

    ReplyDelete
  5. MS also posted this:

    ======================

    Friday, June 04, 2010 11:30 AMAdam ZhuMicrosoft, Moderator



    0
    Vote As Helpful
    Hello Benjamin,

    Since we have not heard from you for several days, here is a brief summary of this post for your reference:

    Problem Description
    ****************
    You would like to know if ASP.NET 4 supports MOSS 2007 so that forms applications on MOSS 2007 could be upgraded to ASP.NET 4.

    My suggestions
    ****************
    ASP.NET 4 indeed supports MOSS 2007

    Additional Information
    **********************
    This forum is for partner support for ASP.NET
    http://social.microsoft.com/Forums/en-US/partnerdevaspnet/threads

    ReplyDelete
  6. Thanks for the post! Talentica helps technology companies transform their ideas into successful products. To know more, visit http://www.talentica.com or write to me at info@talentica.com.

    ReplyDelete
  7. Why does MS support reply say they do support asp.net 4.0 and the article says no?!
    Still confused...

    ReplyDelete
  8. I agree that the MS support response in slightly misleading so I'll try to clarify:

    SharePoint 2007 was built on ASP.NET 2.0.
    SharePoint 2010 was built on ASP.NET 3.5.

    Both versions of ASP.NET use the same CLR as described in the post.

    Whilst developing for both versions of SharePoint mentioned above, it is therefore not possible to utilise .NET 4.0 features. Hopefully this will change in the next version.

    As for utilising ASP.NET forms application on a SharePoint machine, it sounds as though there are no issues from a support standpoint. However, the problem with this approach is that you won't be able to utilise the SharePoint solution framework and I would therefore not recommend hosting .NET 4 solutions in a SharePoint 2007 or 2010 environment.

    Hopefully that clarifies things a little.

    ReplyDelete