3
votes

Project in Delphi 2007, stored in SVN.

"Project settings - version info" - there the project version is stored. When changing the project version *.dproj file and *.res file are changing. And I have to commit them to SVN every time when project version changes.

I want to manage project version with SVN. For example, when building the project from svn tag named "1.12.2" and revision 12993 I want to get a binary *.exe file with version 1.12.2.12993.

To make it, I should create a *.rc file with text presentation of version info. Then make a *.res file and include it to project with {$R version.res}

What shold I write to *.rc file? What should it's structure look like? White an example, please.

Thanks.

3
Just google for MSDN versioninfo structure. Plenty of information there. The first page gives: pisoft.ru/verstak/insider/cw_ver1.htm showing exactly what you are asking for. Googling for MSDN Versioninfo resource turns up the link in David's answer. - Marjan Venema

3 Answers

5
votes

The VERSIONINFO resource is documented on MSDN. A typical such resource script looks like this:

1 VERSIONINFO
FILEVERSION 1,12,2,12993
PRODUCTVERSION 1,12,2,12993
FILEOS 0x40004L
FILETYPE 0x1L
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "000004E4"
      BEGIN
        VALUE "CompanyName", "My Company\0"
        VALUE "FileDescription", "My Program\0"
        VALUE "FileVersion", "My Program\0"
        VALUE "LegalCopyright", "My Company 2012\0"
      END
  END
  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x0000 0x04E4
  END
END
2
votes

Here's how we do it:

We have a dedicated build machine that builds our "official" binaries, then checks them into svn. The binary, along with the .res and .bdsproj, are then checked into svn using special comment tags [Add Project File][Add Res File].

Developers are instructed to NOT checkin .bdsproj and .res files unless functional changes have been made, in which case they need to use the special tags.

SVN uses a pre-commit hook to block .res and .bdsproj checkins without the special tags.

When we create a new project branch, we have a utility (I think it's FindAndReplace.exe) that updates all of the version info in the .bdsproj files to match.

This is NOT exactly what you're looking for, because we're not incorporating the SVN build as part of this. But that could be done, as an extension of this methodology.

2
votes

We use VERSIONINFO as well, but instead of build number we use SVN revision number, which can be supplied by keyword substitution using SubWCRev utility. see Tortoise dox for details. It allows you to get right source snapshot from SVN corresponding to particular .exe