0

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

回答

相關問題