Force Visual Studio to build solutions synchronously

29 Views Asked by At

Visual Studio seems to have changed behaviour recently, somewhere between versions 17.5.5 and 17.7.0. I am wondering if there is a way to restore the old behaviour, since the new behaviour is causing problems with our build process.

We have some solutions containing installer projects (.vdproj). Since MSBuild can't build these, we have an extra build step that calls Visual Studio, as follows:

devenv.com $SolutionFileName /build $BuildConfiguration /out $LogFile

This used to build the solution and wait until it had finished before ending the process. Now it spins off another process to do the build and exits immediately. I can see this happening because:

  • The script runs through all the solutions very quickly without stopping, despite waiting for devenv.com to exit.
  • Build status details used to be written to standard output, but now nothing is written.
  • The log files all start at 0 bytes, and gradually fill with content asynchronously.

There is no mention of this new behaviour in the documentation, or any command line switches to control the behaviour.

Implementation Details

devenv.com is run like this in Powershell, which waits for the devenv.com process to finish, but not for any child processes that it spawns.

$Process = Start-Process -FilePath $FilePath -ArgumentList $ArgumentList -NoNewWindow -PassThru
if($Process) {
    $Handle = $Process.Handle
    if($Process.WaitForExit([int]::MaxValue)) {
        return $Process.ExitCode
    }
}
return -1

If I add -Wait to Start-Process, then it correctly waits for child processes of devenv.com, but still displays nothing on standard output.

0

There are 0 best solutions below