Enabling .NET 3.5 in SharePoint 2007 Sites, the Lazy Way
You probably know that if you want to make use of the fancy new .NET stuff, like ASP.NET AJAX in SharePoint 2007 sites, you have to make a bunch of modifications in the web.config of that site. You can do that the manual way, for example Mike Ammerlaan has described how you can enable ASP.NET AJAX 1.0 in SharePoint sites already a long time ago. Recently .NET 3.5 (including a new version of ASP.NET AJAX) became available, including the steps that you needed to go through to be able to enable it in SharePoint sites. You can check out Tobias Zimmergren’s post for example to get an idea.
Of course the manual approaches work, but it’s quite a lot of XML that you have to copy-and-past into the SharePoint web.config files. If you prefer an automated way to apply those changes, you can check out the SharePoint 2007 Features project on CodePlex. Over there you can find some feature that will apply the changes for you. But before you get too excited; make sure you test those features in your farms, because I’ve had some nasty experiences deploying them in SharePoint farms with multiple front-end web servers.
Today I’d like to introduce you the lazy way to apply the necessary changes for enabling .NET 3.5 (including the corresponding version of ASP.NET AJAX) in SharePoint 2007 sites. Actually it’s my lazy U2U colleague Lieven Iliano who thought me the trick, and I’ve been using it ever since in my classes and demos. The trick is to slightly abuse Visual Studio 2008 (just a little bit) here are the steps:
- Start Visual Studio 2008.
- Create a new dummy ASP.NET Web Application Project, and make sure you target the .NET Framework 2.0 (upper right dropdown of the New Project dialog). The name of this project is not important; you won’t need it anymore when we’re done.
- Copy the web.config of your SharePoint 2007 site, into the dummy Web Application project in Visual Studio.
- Open the Project Properties in Visual Studio (right click on the Project node in the Solution Explorer, and choose Properties; or in the Project menu, select WebApplicationX Properties).
- Select .NET Framework 3.5 in the Target Framework dropdown (select Yes in the confirmation dialog).
- Copy the web.config from the Web Application Project back to SharePoint.