Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"ERROR MSB4040 There is no target in the project" when using msbuild+Delphi2009

I'm trying to automate the build of a project in Delphi 2009.

I'm using msbuild with .net 3.5

I simply call:

Z:\Server>C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild "BestSellerAppServer.g
roupproj" /target:Build

And get this:

Build started 27/08/2009 01:15:45 p.m..
Project "Z:\Server\BestSellerAppServer.groupproj" on node 0 (Build target(s)).
Project "Z:\Server\BestSellerAppServer.groupproj" (1) is building "Z:\Server\Be
stSellerAppServer.dproj" (2) on node 0 (default targets).
Z:\Server\BestSellerAppServer.dproj : error MSB4040: There is no target in the
project.
Done Building Project "Z:\Server\BestSellerAppServer.dproj" (default targets) -
- FAILED.

Done Building Project "Z:\Server\BestSellerAppServer.groupproj" (Build target(s
)) -- FAILED.


Build FAILED.

"Z:\Server\BestSellerAppServer.groupproj" (Build target) (1) ->
"Z:\Server\BestSellerAppServer.dproj" (default target) (2) ->
  Z:\Server\BestSellerAppServer.dproj : error MSB4040: There is no target in th
e project.

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.06

I compile fine inside the IDE.

I found this http://huwk.blogspot.com/2009/02/msbuild-fails-to-compile-delphi-2009.html but not solve the issue.

like image 424
mamcx Avatar asked Aug 27 '09 18:08

mamcx


People also ask

Who builds the first target in MSBuild?

The Microsoft Build Engine (MSBuild) engine builds the first target it finds, and any dependencies, unless the project file contains a DefaultTargets attribute, an InitialTargets attribute, or a target is specified at the command line using the -target switch.

How do I list the default targets of a project element?

List the default targets, separated by semicolons, in the DefaultTargets attribute of the Project element. For example, to run the Clean target and then the Compile target, type:

What happens if no target is specified on the command line?

If targets are specified in both the InitialTargets and DefaultTargets attributes and no target is specified on the command line, MSBuild runs the targets specified in the InitialTargets attribute followed by the targets specified in the DefaultTargets attribute. Specify the default target in the DefaultTargets attribute of the Project element.

What is the initialtargets attribute of the project element?

The InitialTargets attribute of the Project element specifies a target that will run first, even if targets are specified on the command line or in the DefaultTargets attribute. Specify the default target in the InitialTargets attribute of the Project element. For example:


1 Answers

There is a batch file called rsvars.bat (search for it in the RAD Studio folder). Call that before calling MSBuild, and it will setup the necessary environment variables. Make sure the folders are correct in rsvars.bat if you have the compiler in a different location to the default.

like image 59
Steve Avatar answered Sep 18 '22 04:09

Steve