vs2017中的“CL"任务意外失败 [英] The “CL” task failed unexpectedly in vs2017

查看:48
本文介绍了vs2017中的“CL"任务意外失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在构建 VC++ MFC 项目时遇到了如下问题visual stdio 2017.我重新安装了我的 vs 2017,但它仍然存在.它有与我的代码和之前正确运行的所有项目无关由于同样的问题,无法构建.该错误指定代码

I have met a problem as following when building a VC++ MFC project in visual stdio 2017. I reinstalled my vs 2017 but it still exists.It has nothing to do with my code and all projects running correctly before can't be built because of the same problem. The error specifies the code

<!-- 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 但它不起作用.

I tried to disable PrecompiledHeader but it doesn't work.

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()

推荐答案

检查 TEMP 和 TMP 环境变量(用户和系统)并将这两个文件夹的权限设置为完全控制.

Check the TEMP and TMP environment variables (both user and system) and set permissions to Full Control for both those folders.

你可以参考一个类似的问题这里.

You can refer to a similar issue here.

这篇关于vs2017中的“CL"任务意外失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆