5

All my ASP.NET web projects are being developed exclusively in VB.NET. (And so are the satellite DLL projects, which is probably less relevant.

When I look at the default web.config file, under the <system.codedom> tag, I always find compiler definitions present for both C# and VB.NET, as illustrated below.

<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" compilerOptions="/optionstrict+">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="OptionInfer" value="true"/>
        <providerOption name="WarnAsError" value="false"/>
    </compiler>
</compilers>

Will there be a performance gain if I remove the definition for the C# compiler from this list? Or is it a lazy loading system where an irrelevant compiler will simply never be loaded. Or perhaps any drawbacks I might not be thinking of?

I'm in the process of tweaking my applications for live deployment.

Kiquenet
  • 14,494
  • 35
  • 148
  • 243
Joachim VR
  • 2,320
  • 1
  • 15
  • 24

1 Answers1

11

It's lazy loaded. The compiler option specifies which compiler is used for dynamic page compilation based on the file extension. If the file doesn't have that extension, the compiler is never launched.

If you're not using both languages, you can safely remove it. However, if you think you might used mixed-language development in the future, it's best to leave it there, as it does no harm.

Mike Hofer
  • 16,477
  • 11
  • 74
  • 110
  • 1
    Which is **recommended** values for ***production environment*** for ASP.NET 4.5.1 (runtime 4.0)? – Kiquenet Jul 06 '15 at 07:56
  • You don't do dynamic compilation in production as there is overhead for it. More info https://stackoverflow.com/questions/34545520/what-exactly-does-system-codedom-compilers-do-in-web-config-in-mvc-5 – Mandeep Janjua May 10 '18 at 01:39