在vs2017中,“CL”任务意外失败

时间:2017-05-24 18:01:43

标签: visual-studio-2017

我在构建VC ++ MFC项目时遇到了如下问题 视觉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 个答案:

答案 0 :(得分:0)

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

您可以参考类似的问题here