Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build using MSBuild and Delphi XE2

I've been building projects using Delphi XE and MSBuild using the following simple example which works fine in a batch file. Project1 is an empty project created using 'File | New | VCL forms application in the IDE:

call "c:\Program Files (x86)\Embarcadero\RAD Studio\8.0\bin\rsvars.bat" msbuild.exe /target:Build /p:config=Release  "c:\scratch\test\project1.dproj"  pause 

If I created a new empty project in Delphi XE2, save it as project1.dproj (the dproj is VERY different from XE) and run the following:

call "c:\Program Files (x86)\Embarcadero\RAD Studio\9.0\bin\rsvars.bat" msbuild.exe /target:Build /p:config=Release  "c:\scratch\test\project1.dproj"  pause 

It gives:

Build FAILED.  "c:\scratch\test\project7.dproj" (Build target) (1) ->   c:\scratch\test\project7.dproj : error MSB4057: The target "Build" does not e xist in the project.      0 Warning(s)     1 Error(s)  Time Elapsed 00:00:00.00 

I've tried various target names including things I find in Codegear.Delphi.Targets but I dont know wnough about MSBuild. Can anyone help with what I should put please?

LATER RESOLUTION: This was tried on another PC with XE2 and it works ok as suggested by David below. In fact the problem was the content of the RSVARS.BAT file which did not specify the BDS path correctly.

like image 895
Brian Frost Avatar asked Nov 09 '11 16:11

Brian Frost


People also ask

How do I create a project using MSBuild command line?

To build a specific target of a specific project in a solution. At the command line, type MSBuild.exe <SolutionName>. sln , where <SolutionName> corresponds to the file name of the solution that contains the target that you want to execute.

How do I run MSBuild command?

To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.

What is the use of MSBuild?

MSBuild is a build tool that helps automate the process of creating a software product, including compiling the source code, packaging, testing, deployment and creating documentations. With MSBuild, it is possible to build Visual Studio projects and solutions without the Visual Studio IDE installed.


1 Answers

As reported by the OP, the issue was an incorrect BDS path in the RSVARS.bat file.

like image 89
2 revs, 2 users 67% Avatar answered Sep 21 '22 10:09

2 revs, 2 users 67%