Removing roslyn from ASP.NET 4.5.2 project template

If you're using VS 2015 for development, ASP.NET projects now use Roslyn by default. The host I use as a test server doesn't support Roslyn / C# 6.0 yet. Though the website gets published successfully (using Web Deploy), I end up with an Internal Server Error.

According to this, roslyn support is added using a nuget package. So the first thing to do, is to remove the package. Open the Package Manager Console and type the following one line at a time:

uninstall-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
uninstall-package Microsoft.Net.Compilers

Now, remove the following code from web.config:

  <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>

That's it.
Obviously, your code shouldn't be using any C# 6 feature at this point.

Galdin Raphael

Galdin Raphael is an independent full stack developer from Mumbai.

Subscribe to Galdin's Blog

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!