What exactly does / do in web.c

2019-02-05 16:10发布

I am about to migrate a bunch of projects from .NET 4.0 + MVC 3 to .NET 4.5.2 + MVC5.

To make this easier, I've created a new blank MVC project to compare DLL references and some other stuff such as web.config.

In the latter, the following entries are generated by Visual Studio:

<system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
</system.codedom>

But I don't know what this does exactly. The MVC 3 projects don't contain these parts. My understanding is it has something to do with Roslyn?

1条回答
看我几分像从前
2楼-- · 2019-02-05 16:53

These settings are used for dynamic compilation. They can be safely removed from the web.config if you do pre-compilation and only put the compiled assemblies on the webserver.

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

查看更多
登录 后发表回答