1

I have a Visual Studio solution with x projects. Each project has (post) build events consisting of two or more lines.

When the build events are executed, a locking problem occurs:

The specified task executable "cmd.exe" could not be run. The process cannot access the file 'D:\Users\<user>\AppData\Local\Temp\tmpff905f7a0bf94226b86296693df6861c.exec.cmd' because it is being used by another process. 

I suspect that Visual Studio writes the multiple lines to the unique temporary file which should be executed by cmd.exe. I first suspected there was a conflict between parallel builds, but since each build seems to create a unique file, that cannot be the cause.

Anohter nice detail is that the file in question, is not deleted after the error. When I open it, it is empty.

So...

  • Why is there a conflict?
  • Why is it empty?
Martin Mulder
  • 12,642
  • 3
  • 25
  • 54
  • Have you tried using MSBuild diagnostics from the Tools/Options menu? – rrirower Oct 09 '15 at 19:25
  • I have the same problem. However, we got exactly 1 project with exactly 2 lines of post-build steps. Plus it is also affecting VS 2015 ... You could try to concatenate them: http://stackoverflow.com/questions/8055371/how-to-run-two-commands-in-one-line-in-windows-cmd - however, mine was not fixed by this trick – flohack Feb 29 '16 at 15:48
  • At this moment we blame the virus scanner (McAfee). – Martin Mulder Feb 29 '16 at 18:02
  • Changing the TMP environment variable worked for me, see answers [elsewhere][1] [1]: https://stackoverflow.com/questions/37053112/msbuild-error-the-specified-task-executable-cmd-exe-could-not-be-run-the-proce – shaun Mar 07 '19 at 22:02

0 Answers0