views:

1256

answers:

3

I would like to have my CodeGear Delphi 2007 project to automatically set the debug module attributes depending on whether my project is in debug or release mode.

I can manually set this value by right clicking on the project->Version Info->Edit values as needed. These are for the project as a whole and are the same for the debug and release builds.

Is there a way to automatically set the manifest to Debug if the #debug compiler directive is present?

Is there another way to easily detect is an exe was build as a debug or release version?

+1  A: 

There is a Delphi wiki writeup about exactly this question:

Easily Switching between "Debug" and "Release" Builds

lkessler
That is definitely close. I can not locate a way to set/unset the "Debug Build" module attribute though any of these tools though.
That cfg trick won't work in Delphi 2007 since it does not use .cfg files, but uses MSBuild. Well, you can make it work, but it is not the way to do it
Lars Truijens
+2  A: 

You could if you do it the other way around if you use the commandline compiler. Tell the compiler to compile for debug or release. Set a compiler directive to DEBUG for the debug build (it does that by default).

msbuild YourProject.dproj /p:Configuration=Release

msbuild YourProject.dproj /p:Configuration=Debug

Lars Truijens
The problem is, I don't believe the configuration is changing the EXE's manifest. I *may* just have to manually set it after the build with an automated one like you're saying.
+1  A: 

Another solution would be to use a resource editor post build to change it. Like http://www.heaventools.com/rtconsole-update-version-info.htm

Lars Truijens