Python, subprocess, devenv, why no output?

python, subprocess

Solution

You should build the solution with `msbuild.exe` instead, which is designed to give feedback to stdout and stderr. `msbuild.exe` is located at

`C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msbuild.exe` (to build a VS2005 solution) or `C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild.exe` (to build a VS2008 solution)

Note that `msbuild.exe` does not take a `/build` switch like `devenv.exe`.

Problem

I build a Visual Studio solution from a Python script. Everything works nicely, except that I am unable to capture the build output. ``` p = subprocess.Popen(['devenv', 'solution.sln', '/build'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = p.communicate() ret = p.returncode ``` Here, both `out` and `err` are always empty. This happens regardless of the build success as seen in `p.returncode`.

Original source

Related problems