Updating your web.config from .net 2.0 to 3.5

Updating your web.config from .net 2.0 to 3.5 header image

Whenever I make a new SharePoint web application trough the Central Admin, the next thing I do is beating myself up for the fact that it’s a .net 2.0 version, and since we use .net 3.5 stuff in most of the projects we do, we always have to ‘upgrade’. Now there are two ways of doing that, either edit the web.config manually. Or copying it in a ‘blank’ site project in Visual Studio, and then changing the .net version in the project settings.

*Update 21-09-09:

My colleague Vishal pointed me to http://ajaxifymoss.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=13360 that is actually a very nifty tool saving you lots of time updating your web.config! So whenever you have the rights to use install this tool I suggest you use that, instead of doing it manually.However, when you find someone else mad a .net 2.0 web.config on a production environment and you don’t have a Visual Studio present the following might come in handy. The following lines are the lines that have to be added to your web.config in order to upgrade it to version 3.5. So just make a backup copy of your existing web.config, and open the original in notepad. (Make sure that whenever you run it on a Windows 2008 Server, you run your notepad instance as an Administrator in order to be able to safe your work).

Add this to the configSections

<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"requirePermission="false"allowDefinition="MachineToApplication"/>

<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"requirePermission="false"allowDefinition="Everywhere"/>

<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"requirePermission="false"allowDefinition="MachineToApplication"/>

<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"requirePermission="false"allowDefinition="MachineToApplication"/>

<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"requirePermission="false"allowDefinition="MachineToApplication"/>

    <sectionGroup>
  <sectionGroup>
<sectionGroup>

Add the following statement to the HttpModules

<add name="ScriptModule"type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Add the following statement to the Assemblies

<addassembly="System.Core,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<addassembly="System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<addassembly="System.Xml.Linq,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<addassembly="System.Data.DataSetExtensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

Add the following statement below the tagMapping

<controls>

      <addtagPrefix="asp"namespace="System.Web.UI"assembly="System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

      <addtagPrefix="asp"namespace="System.Web.UI.WebControls"assembly="System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<controls>

Add the following statement to the Assemblybinding – runtime

<dependentAssembly>
        <assemblyIdentityname="System.Web.Extensions"publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirectoldVersion="1.0.0.0-1.1.0.0"newVersion="3.5.0.0"/>
<dependentAssembly>

<dependentAssembly>
        <assemblyIdentityname="System.Web.Extensions.Design"publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirectoldVersion="1.0.0.0-1.1.0.0"newVersion="3.5.0.0"/>
<dependentAssembly>

Add the following statement below the system.net

<system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp"extension=".cs"type="Microsoft.CSharp.CSharpCodeProvider,System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"warningLevel="4">
        <providerOption name="CompilerVersion"value="v3.5"/>
        <providerOption name="WarnAsError"value="false"/>
      <compiler>
    <compilers>
  <system.codedom>
  <system.webServer>
    <validationvalidateIntegratedModeConfiguration="false"/>
    <modules>
      <remove name="ScriptModule"/>
      <add name="ScriptModule"preCondition="managedHandler"type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <remove name="ScriptHandlerFactory"/>
      <remove name="ScriptHandlerFactoryAppServices"/>
      <remove name="ScriptResource"/>
      <add name="ScriptHandlerFactory"verb="*"path="*.asmx"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptHandlerFactoryAppServices"verb="*"path="*_AppService.axd"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptResource"verb="GET,HEAD"path="ScriptResource.axd"preCondition="integratedMode"type="System.Web.Handlers.ScriptResourceHandler,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <handlers>
  <system.webServer>

After this you’re done and can safe the web.config, and re-open your site, while being able using the .net 3.5 stuff you need.

Loading comments…