严重性 代码 说明 项目 文件 行 禁止显示状态 工具 错误 MSB6003 指定的任务可执行文件“link.exe”未能运行。System.UnauthorizedAccessException: 对路径“*********\*********\************\x64\Debug\navigati.e0027839.tlog\link.read.2.tlog”的访问被拒绝。 在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 在 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) 在 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) 在 System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost) 在 System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost) 在 System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) 在 Microsoft.Build.Utilities.CanonicalTrackedInputFiles.SaveTlog(DependencyFilter includeInTLog) 在 Microsoft.Build.CPPTasks.TrackedVCToolTask.ComputeOutOfDateSources() 在 Microsoft.Build.CPPTasks.Link.ComputeOutOfDateSources() 在 Microsoft.Build.Utilities.ToolTask.Execute() navigation_VSstudio_V1 D:\Program Files (x86)\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets 1094 Link
错误信息表明编译过程中 link.exe
无法运行,原因是对路径的访问被拒绝。
可尝试删除缓存文件:
- 删除以下路径中的文件:
****\*******\*******\x64\Debug\
- 然后重新生成项目。
然后清理解决方案:
- 在 Visual Studio 中,依次点击
生成 -> 清理解决方案
。 - 然后重新编译。
问题解决。