编译器可执行文件C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ csc.exe找不到

问题描述:

我在Visual Studio 2010上运行的.Net Framework 4.0和MVC2上有一个应用程序。我决定移动这个应用程序到Visual Studio 2015.所以首先我已经升级到MVC3,然后用Visual Studio 2015打开它,因为缺少System.Web.MVC和其他一些dll。我从Nuget安装了Microsoft.AspNet.Mvc v3.0.50813.1。现在我的应用程序正在成功编译。但运行后,它显示此错误:编译器可执行文件C: Windows Microsoft.NET Framework v4.0.30319 csc.exe找不到

Compiler executable file C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe cannot be found. 

该文件csc.exe存在于我的Framework64目录中,但不存在于Framework目录中。

PS:我在安装Visual Studio 2015时遇到了一些困难,我宁愿一个解决方案也不需要重新安装Visual Studio。

堆栈跟踪:Visual Studio 2010中后,不支持

[InvalidOperationException: Compiler executable file C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe cannot be found.] 
    Microsoft.CSharp.CSharpCodeGenerator.Compile(CompilerParameters options, String compilerDirectory, String compilerExe, String arguments, String& outputFile, Int32& nativeReturnValue, String trueArgs) +6840643 
    Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames) +473 
    Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames) +186 
    System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile(CompilerParameters options, String[] fileNames) +24 
    System.Web.Compilation.AssemblyBuilder.Compile() +950 
    System.Web.Compilation.<>c.<PerformBuild>b__22_0(AssemblyBuilder assemblyBuilder) +13 
    System.Threading.Tasks.<>c__DisplayClass42_0`2.<PartitionerForEachWorker>b__1() +1321 
    System.Threading.Tasks.Task.InnerInvoke() +43 
    System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) +18 
    System.Threading.Tasks.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object) +208 
    System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +132 
    System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +502 
    System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +125 
    System.Web.Compilation.BuildManager.CompileResourcesDirectory() +32 
    System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +227 

[HttpException (0x80004005): Compiler executable file C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe cannot be found.] 
    System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +62 
    System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +435 
    System.Web.Compilation.BuildManager.CallAppInitializeMethod() +33 
    System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +545 

[HttpException (0x80004005): Compiler executable file C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe cannot be found.] 
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9947444 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261 
+0

你使用的Windows更新的版本?尝试修复.net 4.x – magicandre1981

MVC3 你将不得不更新到MVC