9

How can I get MSBuild to do a full build of a Delphi project equivalent to dcc32 -b?

I've got two projects I'm trying to build, the first one uses some conditional defines, which are getting passed via msbuild to the dcc32. However, some common units appear to be stuck with the first set of conditionals, so the second project is built improperly.

Zartog
  • 1,906
  • 1
  • 16
  • 27

5 Answers5

11

I believe it's /t:rebuild, the msbuild output lists "Deleting file: ..." for all the dcu's, then builds the project.

I use a batch file to call msbuild to build delphi projects, for Delphi 2007 and Delphi 2009 (which just has a different path for %BDS%):

set DCC_Quiet=true
set BDS=%ProgramFiles%\CodeGear\RAD Studio\5.0
set MSBuildBinPath=%WinDir%\Microsoft.NET\Framework\v2.0.50727

call %MSBuildBinPath%\msbuild /nologo /t:rebuild /p:config=Release %1 %2 %3 %4 %5

[Note, from this question, for Release "Build Configuration", Delphi 2009 is /p:config=Release, and Delphi 2007 is /p:Configuration=Release]

Community
  • 1
  • 1
jasonpenny
  • 2,999
  • 1
  • 24
  • 23
  • 1
    Delphi 2006 used to output many blank lines when run through msbuild on the commandline, setting the DCC_Quiet environment var would pass the -Q parameter to dcc32 (see http://qc.embarcadero.com/wc/qcmain.aspx?d=56289) It looks like it does nothing for Delphi 2009. – jasonpenny Nov 23 '09 at 23:47
  • You can also set DCC_Quiet from the msbuild command line: `msbuild -p:DCC_Quiet=true` – Kenneth Cochran Mar 20 '13 at 19:24
  • @jasonpenny I think that's Delphi 2007 you were talking about, not Delphi 2006. – dummzeuch Mar 31 '18 at 09:51
2

I guess the question Delphi MSBuild Build Configuraions From Command Line contains the answer. Try

msbuild /target:Build
Community
  • 1
  • 1
Uwe Schuster
  • 863
  • 4
  • 7
0

As I remember in D7 there was a similar problem when GUI vs dcc32 produced different builds. Take a look at location and content of your dcc32.cfg file(s). They actually can contain as many conditionals as you need. One conditional per-line

0

Another option is to delete the DCU's of the compiled units after your first build is complete and before you start your next one.

skamradt
  • 15,366
  • 2
  • 36
  • 53
0

With my RAD Studio 2010 Professional, /t:rebuild is not defined. I figured

MSBuild.exe /t:Build /p:config=Release;DCC_BuildAllUnits=true

does the job

Manos Nikolaidis
  • 21,608
  • 12
  • 74
  • 82