Msbuild cannot specify configuration when invoked from another program

68 Views Asked by At

I am using Visual Studio 2017 working with C++.

I can build a release binary with msbuild /p:configuration=release on the command line. When attempting to build from another process using system( "msbuild C:\\Users\\Chili\\Desktop\\Projects\\TestHarness\\TestHarness.sln /p:configuation=release" ), it builds a Debug binary.

When building from the command line using msbuild C:\\Users\\Chili\\Desktop\\Projects\\TestHarness\\TestHarness.sln /p:configuation=release (from a different working directory), I also get the Debug exe. I also tried changing working directory and then invoking from my process with msbuild /p:configuration=release, but it only gives Debug binary. Furthermore, I noticed that from the command line msbuild /p:configuration=invalid will give an error, whereas msbuild /p:configuration=invalid from my process will not give any error (again, builds debug). However, I do know that the command line arguments are reaching msbuild, because if I try for example msbuild /invalid:configuration=invalid from my process, I do get an error about the switch.

EDIT In fact, it seems to be ignoring /p /property -property switches altogether, since I can do /property:bad=food and it doesn't bat an eye.

Does anybody know what is causing this discrepancy between invoking from command line and invoking from process?

0

There are 0 best solutions below