Friday, December 28, 2007

Upgrading .NET FX 2.0 to .NET FX 3.5 and LINQ

After recently upgrading a web project from the 2.0 framework to 3.5 I attempted to use the new language feature LINQ (actually found a really good use for I'll blog about later) however I ran into a problem where it wasn't recognizing the LINQ syntax...after a bit of research I discovered the following, for the ASP.NET compiler to recognize the syntax I need to add the following chunk of xml to my web.config file.  Not sure how this works with the compiled ASP.NET apps and my CI environment, if I need to do anything else I'll post it...

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

Make sense if you think about it...

-ec

No comments:

Post a Comment