views:

819

answers:

8

How can I increment version in project files for delphi projects.I am using Delphi 10 for win32 application development. I consists of bdsproj, dpr & res files for a project.

+4  A: 

If you are using delphi to build your application, you can turn on auto-incrementation of buildnumber under projectsettings.

We use a self made utility to generate a version resource (rc-file) based on values in a ini-file. Then we compile the rc-file into a res-file, that we include in the project. We use finalbuilder-scripts to automate the process. I know finalbuilder has its own support for versionnumbers, but we don't use it. I don't know why, though...

Vegar
A: 

I use a program that manages the version number in a .ini file and generates a .res file in the pre-build event of the project. This .res file contains only the version, not the icon. The icon is contained in a separate .res file. Both are being included in the project's dpr file:

{$R *_version.res}
{$R *_icon.res}

Only the *__i_con.res file gets checked into source conntrol, the version, as said above is maintained in an .ini file, so the *_version.res file can be generated whenever necessary. This gets rid of the annoyance of the .res and .dproj file constantly changing due to incrementing the build number.

Oh, I just realized that you said "Delphi 10", which I think is Delphi 2006. That Delphi version did not have pre- and post-build events, so you would have to call the program for maintaining the version yourself.

dummzeuch
A: 

If you are looking for a non-gui way of doing this then I think if you look in the bdsproj file you will find a section in the xml where the version is written you can change it here. The next time it builds it will use this version.

Toby Allen
AFAIK it's the IDE regenerating the .res file using the proj file information. When building from the command line (even using MSBuild), the .res is not regenerated, it just uses the one it finds.
ldsandon
+2  A: 

I use a proper build script tool FinalBuilder which has a set of property management commands which can set all items in a build to the same version. This gives me consistency of numbering across a build, and a whole load more too. If you don't have a proper build tool, and are still using batch files or equivalent, now is a good time to go look at the options. Well worth doing.

mj2008
+2  A: 

I previously used a program called StampVer, You will need to already have version information in the file to use StampVer. StampVer is Freeware but not Open Source.

The nice thing about stampver, is that it can auto-increment for you.

skamradt
+1 I wrote stampver 12 years ago, amazed it still gets used :)
Paul Dixon
@Paul yes it gets used, thank you!
kenny
A: 

DDevExtensions has a build incrementer in it, I'm not sure how to get the delphi 2006 version, but I think it exists and it's pretty handy stuff.

Peter Turner
A: 

Read this article http://www.thedelphigeek.com/2008/01/tdm-rerun-2-better-build-process.html by Primoz Gabrijelcic, originally published in The Delphi Magazine. It contains a complete description on what you need to do.

PA
A: 

Do you need to increment the build number when you compile from the IDE, or outside? The IDE can increment it automatically, just check the flag in the project settings. Incrementing that number outside the IDE is not simple because it is stored in the default .res file which is managed and regenerated by the IDE. The command line compiler will not modify it. There are several ways to modify it (as other answer explain), and usually it works best with a build system that can generate the build numbers, especially if more than one developers work on the project. I posted QC #70564 issue to ask that version info can be set by the command line compiler.

ldsandon