MSbuild错误:无法运行指定的任务可执行文件cmd.exe。该进程无法访问该文件,因为它正由另一个进程使用

时间:2016-05-05 14:22:05

标签: visual-studio-2012 msbuild

在特定的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提到的位置。

处于类似情况的其他人?

3 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

我打开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)

答案 2 :(得分:0)

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

在我们的案例中,将TEMP和(尤其是)TMP环境变量更改为c:\ temp而不是c:\ users {username} \ AppData \ Local \ Temp,然后重新启动Visual Studio使我们克服了这一点令人沮丧的问题。

(我们的首次修复尝试将TMP设置为c:\ windows \ temp,但这不能解决问题)。

相关问题