Msbuild "configuration" option not passed correctly

When building one Train script I used the following line to build a non standard different build configuration"myproject.dproj", { configuration: "Sandbox", platform: "OSX32" });

However it didn’t build the Sandbox config I have designed in the IDE, but the Release one. At first I blamed Delphi, but then noticed in the Train console output that it didn’t pass the configuration to msbuild properly:, [object Object]) {    Running: C:\Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe /nologo " C:\myproject.dproj" /target:Build "/property:Configuration=Sandbox" "/property:Platform=OSX32"

It passes the configuration as /property:Configuration=Sandbox, while it should be /property:Config=Sandbox as far as I know. Is it something in my Msbuild version or a bug in Train?

Hm, i’m pretty sure /property:Configuration= is correct, and works for me.

check eg,

I’d suggest to reconsider blaming Delphi :wink:

OK, I reconsidered and tested it again with msbuild 3.5 and 4.0 :slight_smile:

The result is the same however. Executing from the command prompt directly

msbuild project.dproj /t:Build /p:Configuration=Sandbox

builds not the configuration that I set, but the one that was last active in the IDE, which in my case was the Release one. While executing the line below works fine.

msbuild project.dproj /t:Build /p:Config=Sandbox

Are you checking with Delphi or a Visual Studio project and could there be a difference in the structure?
In the DPROJ file I see lines like < Config Condition="’$(Config)’==’’">Release</ Config>", which leads me to believe that it is indeed called Config.
It is also mentioned here

Well, there you go. The dproj is broken then. “Configuration” is the msbuild standard. If Embarcadero doesn’t follow that, than it’s not surprising this fails :(.

Yeah… It’s good to have standards and even better if everyone follows them :smile:
I guess I will have to modify the script to launch msbuild directly instead of using the Train API in that project.

Thanks for the confirmation anyway.

or you could just pass it as regular property, e.g.:

msbuild[rebuild]("whatever.dproj", {configuration: "IgnoredBecauseEmbarcadero", ...,  extraArgs: "/p:Config=Sandbox"});

i’d also suggest filing a bug with Embarcadero.

Using the “extraArgs” parameter is easier indeed. Thanks for pointing it out, I haven’t paid attention to it.

I will put it in the Embarcadero QC.

side question: do configurations work ok when using the explicit “delphi” (not msbuild) command?

I’m not sure how to specify the configuration with…).

It uses the DCC compiler directly and not msbuild. I think DCC doesn’t know about named build configurations, but I could be wrong… I will test it if you tell me what how to pass the configuration.

Ah, could be. It’s been a while since I used Delphi :wink:

No problem. The workaround with the “extraArgs” is very convenient.