【问题标题】:System.InvalidOperationException: Compiler executable file csc.exe cannot be foundSystem.InvalidOperationException:找不到编译器可执行文件 csc.exe
【发布时间】:2015-06-19 18:16:43
【问题描述】:

我有一个 .NET 4.0 框架中的应用程序。

此应用程序在安装了 .NET 框架 4.0 的服务器上运行良好(所有以前的版本(3.5 sp1、3.0、2.0)也安装在这台机器上)。出于某种原因,我们必须将此应用程序移动到另一台仅安装了 .NET Framework 4.5.2 的服务器上。因此,当我们将应用程序移动到这个新服务器后,当我们访问它时,我们就会收到以下错误消息:

找不到编译器可执行文件 csc.exe。

异常详细信息:System.InvalidOperationException:找不到编译器可执行文件 csc.exe。

我无法确定导致此问题的原因。请提出建议。

这是完整的堆栈跟踪:

[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

【问题讨论】:

  • 那么,“csc.exe”是否存在于 C:\Windows\Microsoft.NET\Framework64\v4.0.30319 或 C:\Windows\Microsoft.NET\Framework\v4.0.30319 中?
  • @vcsjones:是的,它确实存在。

标签: .net .net-framework-version


【解决方案1】:

我在 windows 应用程序中也遇到了同样的问题,我只是简单地重新安装了 Dot net 框架,它对我有用。

【讨论】:

    猜你喜欢
    • 2013-06-01
    • 2012-10-31
    • 1970-01-01
    • 2012-10-17
    • 1970-01-01
    • 1970-01-01
    • 2020-01-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多