0

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?

chili
  • 665
  • 8
  • 20
  • 1
    Cannot reproduce. Do you have a file somewhere for overriding properties in your projects which only gets picked up in certain cases? Apart from that, msbuild.exe isn't by default in your PATH. So how do you get your commandline and the process using `system` to find it? – stijn Sep 16 '18 at 08:04
  • **Cannot reproduce+1**. Have you create a new blank project to check this issue? It works fine on my side, so this issue should be more related to your project itself, how many projects are there in your solution? When you build your solution, have you confirmed that all your projects have been rebuilt? Besides, If that question persists, please share your build log here. – Leo Liu Sep 17 '18 at 08:20

0 Answers0