Bryan Soltis

Senior Software Engineer
MCPD: Enterprise Application Developer 3.5
MCSD.NET, MCAD, MCP

LINQ to XML Build Errors

Friday, August 28, 2009 06:05 | posted by: bryan

I've built several sites that utilize LINQ to read XML files.  And repeatedly I come across an issue where I seemingly have everything in the right place and coded, yet it does not compile. 

Problem:

 

The solution:

Make sure you have the following section your 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>
<
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>

 Basically this makes sure that .NET will use the right compiler version to execute your code.

 

Tags:

PermaLink   E-Mail Article   RSS Comment Feed  

Add comment


(Will show your Gravatar icon)
Click to change captcha
biuquote
  • Comment
  • Preview
Loading