Enable .NET 3.5 goodies in IIS vdir

Some of you may be oddballs like me:  you like .NET, you program in .NET, but you don't always use Visual Studio.   You hand-code everything for some applications.  You often open up a text editor and just start writing a source module, with no wizards, no project templates, etc.  You hand-code your MSbuild files.  You hand-code your web.config files.

Oddballs like us cannot rely on the code-generation that comes with Visual Studio.  So when we write a new ASP.NET application, and we want to use the .NET 3.5 goodies in that app - things like var types, and LINQ - we need to explicitly specify that we want .NET 3.5 compilation.  Same is true if you are writing a WCF service and want to use REST or any of the var types or LINQ.

I've done this twice now and had to search for the way to do it both times.  I'm putting here as a "note to self" and also as a reference for anyone else.  These are the custom magic incantations for web.config, if you want to enable .NET 3.5 in your ASP.NET app, or in your WCF Service - eg, the cool REST stuff from .NET 3.5.


<?xml version="1.0" encoding="utf-8"?>

<compilation debug="false">
<add assembly="System.Core, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider,System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>


Skip to main content