6

I would like explorer opened up on a certain folder, after the deployment has happened, and I'm using the following to attemp it:

<Target Name="AfterBuild">
  <Exec Command="..."></Exec>
</Target>

However, a simple "explorer \somewhere" causes the build process to block on explorer, and it wont finish until you close explorer. Prefixing it with start explorer \\somewhere doesn't change that either.

Is there a simple way to do this? Thing is that we only deploy to a intermediate stage, and want the last step done manually, and opening an explorer on the relevant folder is a nicety. The Exec command actually calls a BAT file if that matters, using VS.NET 2008, on Server 2008 Standard.

Svend
  • 7,916
  • 3
  • 30
  • 45

3 Answers3

5

What I ended up doing was have a

<Exec Command="..." Timeout="2000"></Exec>

That is, launch Explorer from a different Exec element then the copy-element, and then add a somewhat short timeout on this element. This means VS starts up Explorer, and after 2 seconds, returns.

Svend
  • 7,916
  • 3
  • 30
  • 45
1

What I ended up doing was starting a powershell process to the pre-build events. It executes the command without blocking the rest of the build process.

powershell start-process -workingdirectory "..." "cmd " """/k ..."""
Nick Murphy
  • 129
  • 1
  • 6
-1

In the DOS shell you can use cmd /c to call another process and not wait for it's return. You this works fine as a post-build event.

<Target Name="AfterBuild">
  <Exec Command="cmd /c start explorer"></Exec>
</Target>
MyItchyChin
  • 13,733
  • 1
  • 24
  • 44
  • 1
    Well, tried CMD /C, makes no difference it seems. Firing up cscript and using WScript.shell's "run" is no-go as well. – Svend Aug 07 '09 at 19:08
  • Sorry, didn't notice your reply CptSkippy. Anyway, it runs, but doesn't return. IE, VS is blocked by the waiting Explorer window. – Svend Aug 29 '09 at 02:18
  • @MyItchyChin Actually I was talking about Svend's first comment: this does not seem to work, even though it looks like it should. I certainly was not able to get it to work! – Keith Pinson May 21 '14 at 22:42
  • 1
    @Kazark Just a gentle note; it's better to try to inquire about an answer not working a bit more... gently. Often there's a little error that can be fixed, or some minor misunderstanding or the like. An answer does not necessarily need to be deleted. – Andrew Barber May 21 '14 at 22:55