TFS 2018构建失败,并显示错误MSB6006:“ csc.exe”已退出,代码为1

时间:2018-08-29 16:24:25

标签: c# visual-studio tfs tfsbuild

我最近构建了一个新的TFS 2018(更新3)服务器,并添加了Visual Studio Build Tools(v15.7.1)。创建非常简单的C#项目后,服务器构建失败,并显示错误MSB6006:“ csc.exe”退出并显示了代码1。我打开调试并发现了错误

  

无法加载文件或程序集'Microsoft.CodeAnalysis.CSharp,   版本= 2.8.0.0,文化=中性,PublicKeyToken = 31bf3856ad364e35'或   它的依赖项之一。该系统找不到指定的文件。   (TaskId:32)

我的项目未引用该库,并且在项目级别关闭了代码分析功能,因此我认为这是VS Build Tools的问题。有谁知道解决方法或解决此问题的方法?

我还注意到了VS Build Tools(v15.8)的较新版本。我尚未尝试更新构建服务器,因为生成脱机软件包,压缩,上传等操作的复杂性很高,但是如果找不到短期修复程序,这将是我的下一个工作。

基本上,我们的新服务器已经死了,没有解决方案,所以我希望有人在这里给出答案,否则,我可能最终将所有这些废弃在一起以获得更可靠的东西。

1 个答案:

答案 0 :(得分:2)

似乎是版本15.7.1中的错误。尚不清楚是否有其他版本受此错误影响,但是升级到VS Build Tools至15.8.2可以解决此问题。

要发现错误MSB6006的根本问题:使用代码1退出“ csc.exe”,请在MSBuild参数中设置以下标志:

/v:diag

这将产生类似于以下内容:

2018-08-29T21:07:25.0630293Z                      Task Parameter:WarningLevel=4 (TaskId:23)
2018-08-29T21:07:25.0630927Z                      C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Net.Http.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.Linq.dll" /debug:pdbonly /filealign:512 /optimize+ /out:obj\Release\Epay.Common.Core.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /subsystemversion:6.00 /target:library /utf8output Extensions\ObjectExtensions.cs Properties\AssemblyInfo.cs "C:\Windows\TEMP\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs" (TaskId:23)
2018-08-29T21:07:25.0631621Z                      Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Roslyn (TaskId:23)
2018-08-29T21:07:25.5959306Z 16:07:24.786     6>CoreCompile: (TargetId:111)
2018-08-29T21:07:25.5959917Z                      Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. (TaskId:63)
2018-08-29T21:07:25.6127920Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): Error MSB6006: "csc.exe" exited with code 1.
2018-08-29T21:07:25.6128554Z 16:07:25.608     6>C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error MSB6006: "csc.exe" exited with code 1. [D:\TfsData\BA01\_work\8\s\Epay.Common\Security\Security.csproj]
2018-08-29T21:07:25.6141937Z                      Output Item(s): CscCommandLineArgs= (TaskId:63)
2018-08-29T21:07:25.6143738Z                    Done executing task "Csc" -- FAILED. (TaskId:63)