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

时间:2017-06-18 17:36:17

标签: asp.net-mvc visual-studio asp.net-mvc-3 visual-studio-2015 .net-4.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。现在我的应用程序正在成功编译。但运行后,它会显示以下错误:

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。

堆栈追踪:

[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

1 个答案:

答案 0 :(得分:-1)

Visual Studio 2010后不支持Mvc3 您必须更新到更新版本的mvc