Discussion:
Delphi .RES and version info
Miles Izzo
2005-09-21 04:33:25 UTC
Permalink
Hi everyone,

Apologies if this has been covered before (I searched the mailing lists
but couldn't find anything that was specific to this).

We are using Subversion with Delphi (version 7 - we started with 2005
but it was too unstable) and we're storing version (ie, build number)
information in the .RES file (which Delphi does automatically). Is there
some 'good' recommended way of using Subversion with these resource
files?

AFAICS, if I commit a .RES file with, say, build 1000 where previously
it was 990 and my colleague commits a build file with 998 (ie, he did 8
builds and I did 10 builds) we will get a conflict. Really, the build
number should go to 1008 (his 8 builds plus my 10 builds) shouldn't it?
Is there any way to make Subversion work well with these (binary) .RES
files? Should I just forget about trying to use them with Subversion?

Thanks for any pointers.
--
Regards,
Miles Izzo
gaia at 14:28:31 up 116 days, 16:50, 10 users, load average: 1.08, 1.10, 1.09
Steve Williams
2005-09-21 04:45:23 UTC
Permalink
Post by Miles Izzo
We are using Subversion with Delphi (version 7 - we started with 2005
but it was too unstable) and we're storing version (ie, build number)
information in the .RES file (which Delphi does automatically). Is there
some 'good' recommended way of using Subversion with these resource
files?
AFAICS, if I commit a .RES file with, say, build 1000 where previously
it was 990 and my colleague commits a build file with 998 (ie, he did 8
builds and I did 10 builds) we will get a conflict. Really, the build
number should go to 1008 (his 8 builds plus my 10 builds) shouldn't it?
Is there any way to make Subversion work well with these (binary) .RES
files? Should I just forget about trying to use them with Subversion?
There is no way to automatically handle that, even for Subversion. One
person will have to overwrite the other person's changes.
--
Sly


This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.
Martin Tomes
2005-09-21 07:59:40 UTC
Permalink
Post by Miles Izzo
We are using Subversion with Delphi (version 7 - we started with 2005
but it was too unstable) and we're storing version (ie, build number)
information in the .RES file (which Delphi does automatically). Is there
some 'good' recommended way of using Subversion with these resource
files?
Can you use the FileVersion or ProductVersion which are in the .dof
file? We use a component to extract the version number from there. We
set it in Project/Options/Version Info and use the
dfsVersionInfoResource component from the 'dfs' package to display it.

The .dof file is text and so can be merged.
--
Martin Tomes
echo 'martin at tomes x org x uk'\
| sed -e 's/ x /\./g' -e 's/ at /@/'

Visit http://www.subversionary.org/
Steve Williams
2005-09-21 13:08:29 UTC
Permalink
Post by Martin Tomes
Can you use the FileVersion or ProductVersion which are in the .dof
file? We use a component to extract the version number from there. We
set it in Project/Options/Version Info and use the
dfsVersionInfoResource component from the 'dfs' package to display it.
The .dof file is text and so can be merged.
They are using the "Automatically increment build number" feature, so both
his the other client's machines will be updating the same line of text,
therefore conflicts will always occur.
--
Sly



This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.
Martin Tomes
2005-09-21 14:58:36 UTC
Permalink
Post by Steve Williams
Post by Martin Tomes
Can you use the FileVersion or ProductVersion which are in the .dof
file? We use a component to extract the version number from there. We
set it in Project/Options/Version Info and use the
dfsVersionInfoResource component from the 'dfs' package to display it.
The .dof file is text and so can be merged.
They are using the "Automatically increment build number" feature, so both
his the other client's machines will be updating the same line of text,
therefore conflicts will always occur.
Yes, but they are resolvable whereas the .res file isn't.
--
Martin Tomes
echo 'martin at tomes x org x uk'\
| sed -e 's/ x /\./g' -e 's/ at /@/'

Visit http://www.subversionary.org/
Leon Zandman
2005-09-21 08:02:08 UTC
Permalink
Hi,
Is there some 'good' recommended way of
using Subversion with these resource files?
I've had lots of troubles with Delphi projects and SCM systems in a
multi-user environment in the past. Delphi automatically creates some
files that shouldn't be shared with other users, because that will give
you trouble. The files I'm talking about are the RES, DSK and CFG files.
So I never add these files to my SCM repositories. Unfortunately the
project's main RES file includes the application's main icon. So that
icon will also be lost forever.

To solve this I totally bypass the creation of the application's RES
file and manually add a .RC to my project that takes care of including
the main icon to my application. Unfortunately this has another side
effect: the addition of the application's version information will also
be skipped. So I add another .RC file to my project that contains the
version info. Now you should no longer use the project properties dialog
for changing the icon and/or the version info, but you should change the
.RC files instead.

So to sum it up:

1) Create a new application project

2) Remove the line "{$R *.res}" from the project's source (.DPR file).

3) Copy the icon you want your project to use as it's main icon into the
project's directory.

4) Create a file called "ExeIcon.RC" which should only consist of one
line:

MAINICON ICON "icon.ico"

Note that "icon.ico" should be changed to your icon's filename.

5) Create a file called "VersionInfo.RC" with the following contents:

1 VERSIONINFO
FILEVERSION 1,1,1,100
PRODUCTVERSION 1,1,1,100
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "Your Company Name\000"
VALUE "FileDescription", "Your File
Description\000"
VALUE "FileVersion", "1.1.1.100\000"
VALUE "InternalName", "Your Internal name\000"
VALUE "LegalCopyright", "Your Legal Copyright\000"
VALUE "LegalTrademarks", "Your Legal
Trademarks\000"
VALUE "OriginalFilename", "Your Original
Filename\000"
VALUE "ProductName", "Your Product Name\000"
VALUE "ProductVersion", "1.1.1.100\000"
VALUE "Comments", "Your Comments\000"

; These values below can be removed at will
VALUE "PrivateBuild", "Your Private Build\000"
VALUE "SpecialBuild", "Your Special Build\000"
END
END

BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409 0x04E4
END
END

Note the "\000" at the end of each resource string. I found this
necessary for most of the lines. The ones that contain a version number
can do without it, but just to be consistent I added them at the end of
every line.

6) Add both .RC files to your Delphi project. This will ensure they are
automatically compiled into .RES files when the project is built.

7) Build your project and it should all work fine!

For the above project the only files you need to check into Subversion
are:

* Project.DPR
* Project.DOF
* Unit1.PAS
* Unit1.DFM
* Icon.ICO
* ExeIcon.RC
* VersionInfo.RC

I've created a sample (Delphi 6) project that uses this method. You can
download it from the following location:

http://www.wirwar.com/BypassRES.zip

Greetings,

Leon Zandman
Loading...