I’m trying to use msbuild.build to build a Delphi project. Unfortunately, I get the “MSBuild is not set in the environment path!” error.
I’ve also added the line
shell.exec(“c:/Program Files (x86)/Embarcadero/RAD Studio/9.0/bin/rsvars.bat”);
before calling msbuild.build, but that didn’t help either.
How should I set the MSBuild environment path properly and do I need to call rsvars.bat when using Train’s msbuild?
What you need to do is to make sure that the environment variable ‘MSBuild’ exists when running the Trains script.
I did that by added the variable to the system variables using the System properties in windows.
The variable should contain the path to MSBuild.exe
This is the content on my system:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe
Yep, I’ve already found that (after looking at sources). Thanks anyway.
But now I have another issue. I’m calling:
msbuild.build(“d:/Foo/Bar.dproj”, {configuration: “Release”, platform: “Win32”});
… but get the following error:
C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\bin\CodeGear.Common.Targets(
170,5): error : Invalid PLATFORM variable “Release”. PLATFORM must be one of the
following: “Win32”, “Win64”, or “OSX32”. If PLATFORM is defined by your system’
s environment, it must be overridden in the RAD Studio IDE or passed explicitly
on the command line to MSBuild; e.g., /p:Platform=Win32.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.01
MSBuild failed
} msbuild.build
} script
Changing “configuration” to “Win32” makes things working, but that sounds wrong. And how can I control configuration itself (release, debug)?
There is also a Delphi project builder class exposed in Train. (Delphi.build) I think RO uses that to build their Delphi Code. I use MSBuild, but I only have Oxygene code.
That’s odd (delphi). The standard flag is configuration. but you can always use extraArgs:
msbuild.build(“d:/Foo/Bar.dproj”, {extraArgs: “/config:Release”, platform: “Win32”});