Visual Studio asynchronous build events
Today I wanted to add a quick async build event to Visual Studio – specifically I wanted to send a quick wake up call to some sites and services hosted in IIS.
powershell "Start-Process powershell.exe -ArgumentList '-WindowStyle hidden', '-Command &{Invoke-WebRequest -Uri http://localhost }'" |
I added this to my post build events, which seems to work pretty well.
In short it uses powershell to launch powershell.exe in an async process – and then runs a simple command to wake the actual site up. The script block and powershell parameter are passed in via the ArgumentList.
I don’t bother with a NoExit parameter, as I don’t really care what happens to the process after it’s sent the request – the work to wake the sites up is done.
Leave a Reply