0

Possible Duplicate:
MSBuild exec task without blocking

In MSBuild I need to launch a process (vsperfcmd) but not wait around for it to finish since it blocks indefinitely until a shutdown command is called from elsewhere. I'm currently launching it with the exec task:

<exec command="vsperfcmd /start:coverage /output:test.coverage" />

I've tried using "start" but I get the same blocking issue

<exec command="start vsperfcmd /start:coverage /output:test.coverage" />

Strangely the same command does not block if entered at the command line.

Community
  • 1
  • 1
Mark Heath
  • 48,273
  • 29
  • 137
  • 194

2 Answers2

1

Perhaps you could try putting the command in a DOS batch file and invoking the batch file instead. Not very elegant but might do the trick. If that doesn't work then call a batch file which calls another to do the work. e.g.

mycommand1.bat:

mycommand2.bat

mycommand2.bat:

vsperfcmd /start:coverage /output:test.coverage

mycommand1 will NOT wait for the mycommand2 to complete before continuing (unless you used CALL mycommand2).

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Mark D Jackson
  • 623
  • 1
  • 8
  • 15
-1

Try something like this in your exec task, which runs explorer and then returns immediately,

<Target Name="Build">
  <Message Text="Before" />
  <Exec Command="start $(COMSPEC) /k &quot;$(WINDIR)\explorer.exe &amp; exit&quot;" />
  <Message Text="After" />
</Target>

Since the command you are executing has arguments, you may need to experiment with getting that command properly enclosed in quotes. Take a look at the "help cmd" /S option.

Brian Kretzler
  • 9,748
  • 1
  • 31
  • 28