MSB401 RRS feed

  • Question

  • 严重性 代码 说明 项目 文件 禁止显示状态 禁止显示状态
    错误 MSB4018 “CL”任务意外失败。
    System.TypeInitializationException: “Microsoft.Build.Utilities.FileTracker”的类型初始值设定项引发异常。 ---> System.UnauthorizedAccessException: 拒绝访问。 (异常来自 HRESULT:0x80070005 (E_ACCESSDENIED))
       在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
       在 Microsoft.Build.Shared.NativeMethodsShared.ThrowExceptionForErrorCode(Int32 errorCode)
       在 Microsoft.Build.Shared.NativeMethodsShared.GetLongFilePath(String path)
       在 Microsoft.Build.Utilities.FileTracker..cctor()
       --- 内部异常堆栈跟踪的结尾 ---
       在 Microsoft.Build.Utilities.FileTracker.FormatRootingMarker(ITaskItem[] sources)
       在 Microsoft.Build.CPPTasks.CL.ComputeOutOfDateSources()
       在 Microsoft.Build.CPPTasks.TrackedVCToolTask.SkipTaskExecution()
       在 Microsoft.Build.Utilities.ToolTask.Execute()
       在 Microsoft.Build.CPPTasks.VCToolTask.Execute()
       在 Microsoft.Build.CPPTasks.TrackedVCToolTask.Execute()
       在 Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
       在 Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() ConsoleApplication1 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets 487
    Wednesday, November 27, 2019 7:04 AM

All replies

  • Hi pagexw,

    Welcome to MSDN forum.

    According to this error, you could try to run VS as administrator, then right-click your project -> Clean, and rebuild it to check if it could work.

    In addition, please confirm the permissions of your account in your dev environment.

    Look forward to your feedback.

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, November 27, 2019 10:04 AM