title: System.InvalidOperationException: Compiler executable file csc.exe cannot be found
body: <p>I have an application in .NET 4.0 framework.</p>
  
  <p>This application was running fine on server with .NET framework 4.0 installed on it (also all previous versions (3.5 sp1, 3.0, 2.0) are installed on this machine). For some reason we have to move this application to another server which only has .NET framework 4.5.2 installed on it. So as soon as after moving application to this new server when we access it, we are having this error message: </p>
  
  <blockquote>
    <p>Compiler executable file csc.exe cannot be found.</p>
    
    <p>Exception Details: System.InvalidOperationException: Compiler executable file csc.exe cannot be found.</p>
  </blockquote>
  
  <p>I am not able to determine what's causing this problem. Please suggest.</p>
  
  <p>Here is complete stack trace:</p>
  
  <pre><code>[InvalidOperationException: Compiler executable file csc.exe cannot be found.]
     System.CodeDom.Compiler.RedistVersionInfo.GetCompilerPath(IDictionary`2 provOptions, String compilerExecutable) +8338603
     Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames) +739
     Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames) +170
     System.Web.Compilation.AssemblyBuilder.Compile() +12114384
     System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +301
     System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +12653841
     System.Web.Compilation.BuildManager.CompileGlobalAsax() +50
     System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +665
  
  [HttpException (0x80004005): Compiler executable file csc.exe cannot be found.]
     System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +80
     System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +1142
     System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1193
  
  [HttpException (0x80004005): Compiler executable file csc.exe cannot be found.]
     System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12656404
     System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
     System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12496021
  </code></pre>