Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The impact of multiple compiler definitions in system.codedom in web.config

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.

like image 648
Joachim VR Avatar asked Jan 03 '12 13:01

Joachim VR


People also ask

What is System CodeDOM in web config?

The <system. codedom> element contains compiler configuration settings for language providers installed on a computer in addition to the default providers that are installed with the . NET Framework, such as the CSharpCodeProvider and the VBCodeProvider.

What is system CodeDOM dll?

The System. CodeDom namespace in . net allows the users to dynamically compile and create assemblies. This concept is used by ASP.NET internally. The article provides an insight on how to create assemblies dynamically.


1 Answers

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.

like image 102
Mike Hofer Avatar answered Oct 08 '22 14:10

Mike Hofer