28

When I execute delphi 2009 project using MSBuild command line, output always goes to C: drive

C:\MyProjects>MSbuild "C:\MyTestProject\Test.dproj" /t:Build /p:OutDir="C:\Output\bin\"

Why is this happening?

Alex Myers
  • 6,196
  • 7
  • 23
  • 39
fr21
  • 1,746
  • 7
  • 26
  • 45

2 Answers2

31

I know the docs say otherwise, but try OutputPath instead of OutDir.

JP Alioto
  • 44,864
  • 6
  • 88
  • 112
  • 2
    Yeah OutputPath should be used instead of OutDir, the docs are wrong in this case. – Sayed Ibrahim Hashimi Jul 06 '09 at 05:06
  • 7
    It's better to use `DCC_ExeOutput` instead of `OutputPath`, because when you have `PostBuildEvents` and you are using `$(OutputPath)`, then `/p:OutputPath="xxx"` will *NOT* be used in `$(OutputPath)`, but if you use `/p:DCC_ExeOutput="xxx"` then it will work correctly. – Krystian Bigaj Nov 21 '14 at 06:23
  • I tried this, but MSBuild seems to ignore `OutputPath` when the linker output directory is specified in the project options. – Jim Fell Oct 28 '15 at 20:36
  • 3
    I found this very amusing: http://www.pseale.com/i-hate-you-outdir-parameter it shows a lot of things that can go wrong with OutDir. – JensG Jul 01 '16 at 22:54
7

For Delphi projects you need to use DCC_ExeOutput to specify where the EXE should go.

C:\MyProjects>MSbuild "C:\MyTestProject\Test.dproj" /t:Build /p:DCC_ExeOutput="C:\Output\bin\"

Take a look inside Test.dproj for any other options you might want to specify.

Lars Truijens
  • 42,837
  • 6
  • 126
  • 143
  • others properties that affect the Delphi compiler (DCC) can be found here : [http://stackoverflow.com/questions/what-are-the-msbuild-project-level-properties-for-delphi](http://stackoverflow.com/questions/2373991/what-are-the-msbuild-project-level-properties-for-delphi) – Stéphane B. Apr 19 '12 at 13:11