【问题标题】:MSbuild error: The specified task executable cmd.exe could not be run. The process cannot access the file, because it is being used by another processMSbuild 错误:无法运行指定的任务可执行文件 cmd.exe。该进程无法访问该文件,因为它正被另一个进程使用
【发布时间】:2016-05-05 14:22:05
【问题描述】:

在特定的 Windows 更新之后,MSBUild 一直在抛出这个:

The specified task executable cmd.exe could not be run. The process cannot access the file, because it is being used by another process

这个问题非常持久。我尝试增加“并行项目构建的最大数量”,但无济于事。我没有找到任何其他软件限制非管理员访问 MSBuild 提到的位置。

还有没有类似情况的人?

【问题讨论】:

  • 使用msbuild <myproject> /v:d从命令行执行构建并粘贴包含错误消息和相关上下文消息的更大的sn-p。
  • 这里是:(PostBuildEvent target) -> C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(4264,5): error MSB6003: The specified task executable "cmd.exe" could not be run. The process cannot access the file 'C:\Users\ctuft\AppData\Local\Temp\tmp 8c89d6440ec743acba7e22d98d773e3b.exec.cmd' because it is being used by another process. [D:\mysolution\WebAPI\mysolution.csproj]
  • 我想在这里建立一个解决方案,而不是一个项目。
  • 您是否正在运行任何防病毒软件?尝试禁用所有监控和抗病毒软件。
  • 我们正在使用 Mcafee,并且我确实从 MACfee 控制台禁用了我所能做的一切,但我仍然得到同样的错误。 :(

标签: visual-studio-2012 msbuild


【解决方案1】:

此问题在另一次 Windows 更新后立即得到解决。

【讨论】:

    【解决方案2】:

    我们在 Windows 10 上从最近更新的 Visual Studio 2017 构建 C# 解决方案时遇到了同样的问题,并且 McAfee 病毒扫描处于活动状态(并被我们的 IT 人员锁定)。

    在我们的例子中,将 TEMP 和(尤其是)TMP 环境变量更改为 c:\temp 而不是 c:\users{username}\AppData\Local\Temp 然后重新启动 Visual Studio 让我们非常顺利令人沮丧的问题。

    (我们的第一次修复尝试将 TMP 设置为 c:\windows\temp 但这并没有解决问题)。

    【讨论】:

      【解决方案3】:

      打开 MSBUILD 的诊断日志记录(工具 -> 选项 -> 项目和解决方案 -> 构建和运行)后,我注意到我的问题在于 NuGet 恢复:

      2>C:\Code\EEE\Dev\Current\Source\.nuget\NuGet.targets(92,9): error
        MSB6003: The specified task executable "cmd.exe" could not be run. The
        process cannot access the file 'C:\Users\myUserName\AppData\Local\Temp\
        tmp271c9a670c43427c9ba44267a4152430.exec.cmd' because it is being used by 
        another process.
      2>Done executing task "Exec" -- FAILED. (TaskId:13)
      2>Done building target "RestorePackages" in project
       "TTT.EEE.Tests.Unit.csproj" -- FAILED.: (TargetId:11)
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-12-10
        相关资源
        最近更新 更多