Compiler executable file csc.exe cannot be found

csc-not-found2Parser Error Message: Compiler executable file csc.exe cannot be found. I recently ran into this error when upgrading an application from ASP.NET 2.0 to ASP.NET 3.5 on IIS7.5.

no-compilersI tried a few different things that did not work like restarts and clearing ASP.NET Temp Files. What resolved it for me was removing the <compiler /> entries from <system.codedom> in the web.config.

 <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
 <providerOption name="CompilerVersion" value="v3.5"></providerOption>
 <providerOption name="OptionInfer" value="true"></providerOption>
My Change

I’m not clear yet what the impact is of removing the <compiler />. The MSDN Documentation describes it like this

Each <compiler> element specifies the compiler configuration attributes for a specific language provider. The provider extends theSystem.CodeDom.Compiler.CodeDomProvider class for a specific language; the <compiler> element defines the compiler and code generator settings for the language provider.

The .NET Framework defines the initial compiler settings in the machine configuration file (Machine.config). Developers and compiler vendors can add configuration settings for a new CodeDomProvider implementation. Use the CodeDomProvider.GetAllCompilerInfo method to programmatically enumerate language provider and compiler configuration settings on a computer.

Compiler elements in the application or Web configuration file can supplement or override the settings in the machine configuration file. If more than one provider implementation is configured for the same language name or the same file extension, the last matching configuration overrides any previous configured providers for that language name or file extension.

I also found that in the ASP.NET 4.0 upgrade steps you remove the <compiler /> entries. So it seems to be deprecated after .NET 3.5

My New Stories

March 2016 Web Hosting Deals
Powershell AD Group Management
Troubleshooting 403