Our project is configured in VS.NET as a .NET 3.5 website; web.config references 3.5.0 assemblies and there's plenty of references to System.Linq in classes.
This morning I cane across an instance where I thought it might be useful to use a LINQ query to extract a filtered List from another List
var filtered = (from m in data where m.DepartmentID = 1 select m)VS.NET syntax highlighting was happy and showed no errors. However, when I browsed to the website I got the error "the type or namespace name 'var' could not be found" and varyingly various different "missing )" errors.
Clearly IIS wasn't treating this website as a 3.5 site. Easy to fix thankfully, I just added the following to web.config:
<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>
</compilers>
</system.codedom>