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>
Hi,
ReplyDeleteWhat is the exact version of your CMS? Since 4.1 is the code you added to the web.config, present by default. Or, it is also possible that tha project was installed for .Net 2.0 and then converted to 3.5.
Best Regards,
Juraj Ondrus (Kentico)
Thanks a lot for sharing the info....
ReplyDeleteVery much helpful to me...
Kentico Developers
I’m really amazed with your posting skills as well as with the layout on your blog site. Is this a paid style or did you modify it yourself? Either way keep up the pleasant quality writing, it is rare to see a great site such as this one these days.
ReplyDeleteandroid development agency