vs2017中的“CL”任务意外失败
Posted
技术标签:
【中文标题】vs2017中的“CL”任务意外失败【英文标题】:The “CL” task failed unexpectedly in vs2017 【发布时间】:2017-05-24 18:01:43 【问题描述】:我在构建 VC++ MFC 项目时遇到了如下问题 visual stdio 2017。我重新安装了我的 vs 2017 但它仍然存在。它有 与我的代码和之前正常运行的所有项目无关 由于同样的问题,无法建造。该错误指定 代码
<!-- Precompiled headers - need to build them first -->
<CL Condition="'%(ClCompile.PrecompiledHeader)' == 'Create' and '%
(ClCompile.ExcludedFromBuild)'!='true' and '%(ClCompile.CompilerIteration)'
== ''"
in D:\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets.
我尝试禁用 PrecompiledHeader 但它不起作用。
MSB4018 The “CL” task failed unexpectedly
System.TypeInitializationException: The type initializer for
“Microsoft.Build.Utilities.FileTracker”threw an exception。 --->
System.IO.FileNotFoundException: The system can not find the file
specified. (Exception from HRESULT:0x80070002) in
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
errorCode, IntPtr errorInfo) in
Microsoft.Build.Shared.NativeMethodsShared.ThrowExceptionForErrorCode(Int32
errorCode) in
Microsoft.Build.Shared.NativeMethodsShared.GetLongFilePath(String
path) in Microsoft.Build.Utilities.FileTracker..cctor() --- End
of internal exception stack trace --- in
Microsoft.Build.Utilities.FileTracker.FormatRootingMarker(ITaskItem[]
sources) in Microsoft.Build.CPPTasks.CL.ComputeOutOfDateSources()
in Microsoft.Build.CPPTasks.TrackedVCToolTask.SkipTaskExecution()
in Microsoft.Build.Utilities.ToolTask.Execute() in
Microsoft.Build.CPPTasks.TrackedVCToolTask.Execute() in
Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
in
Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
【问题讨论】:
【参考方案1】:检查 TEMP 和 TMP 环境变量(用户和系统)并将这两个文件夹的权限设置为完全控制。
您可以参考类似的问题here。
【讨论】:
以上是关于vs2017中的“CL”任务意外失败的主要内容,如果未能解决你的问题,请参考以下文章
VS2015 “GenerateResource”任务意外失败 解决方法
VS2010 数据库项目部署——“SqlDeployTask”任务意外失败,NullReferenceException