How to compile Delphi RES file from commandline
Asked Answered
S

3

12

I never worked with Delphi before, so maybe the question looks a simple minded, But I need to change FileVersion in RES resource file parameter from command line...

Steading answered 14/6, 2009 at 14:34 Comment(0)
S
18

Here can find the Borland resource compiler:

%ProgramFiles%\Borland\Delphi7\Bin\brcc32.exe

EDIT: As mghie mentioned you could create a RC file like this one:

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1, 0, 0, 100
PRODUCTVERSION 1, 0, 0, 1
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x9L
#else
 FILEFLAGS 0x8L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "Modified by BZCToOn's"
            VALUE "CompanyName", "Syntheretix"
            VALUE "FileDescription", "rcversion MFC Application"
            VALUE "FileVersion", "1, 0, 0, 100"
            VALUE "InternalName", "rcversion"
            VALUE "LegalCopyright", "Copyleft (C) Bzc ToOn'S 2002"
            VALUE "OriginalFilename", "rcversion.EXE"
            VALUE "PrivateBuild", "RCVERSION-20030212_100"
            VALUE "ProductName", "rcversion Application"
            VALUE "ProductVersion", "1, 0, 0, 1"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

(copied from http://www.codeproject.com/KB/applications/cb2rcversion.aspx)

And compile it using BRCC32. Before you have to disable version information in project settings.

EDIT: Further information ...

http://msdn.microsoft.com/en-us/library/aa380599.aspx

http://msdn.microsoft.com/en-us/library/aa381058.aspx

Sesquioxide answered 14/6, 2009 at 14:41 Comment(2)
Of course you can. Disable the version resource in the project options, add a version resource to an rc file (maybe together with other resource types), compile this to res using the command line resource compiler, and include it in the program using the {$R filename.res} directive. More than one .res file can be linked into the application. Some things like getting the build number from SVN revision, or properly setting the DEBUG resource flag depending on the build type can't be done in the IDE.Position
@Savash: MSDN has all the information you need: msdn.microsoft.com/en-us/library/aa380599(VS.85).aspx. You should make sure that you use the correct values in the "Translation" block, this depends on your language / the language your program is in. In most documentation and samples this will be set to English locale, you may need to change the values to your own. Again, see the MSDN documentation for further details.Position
C
10

Just going to add to ulrichb's answer...

Hint: Create an .RC file and use the {$R} directive to include it to your project.

{$R 'Splash.res' 'Splash.rc'}

Above directive is what I use to include an image for a splash screen. It will automatically compile the .RC file. As an option, you can just include the .RC to your Delphi project, in which case the above line will be added to your project file (*.DPR) and it will also automatically compile. (And you can use Delphi to edit the .RC file.)

Do be careful that you don't give the resource file the same name as your project file. This becomes too confusing for Delphi.

Copse answered 14/6, 2009 at 20:36 Comment(0)
G
4

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

Or use StampVer

Greenback answered 14/6, 2009 at 14:40 Comment(5)
+1 as stampver achieves the desired result. And I wrote it :)Inn
@PaulDixon link is broken, is elphin.com/downloads/stampver the new location?Clap
That link is fine, the other link is temporarily down. I'll ensure it is brought back up!Inn
@PaulDixon Can't seem to find a current working link to StampverGreenback
It's in the comments, but I've edited the original post.Inn

© 2022 - 2024 — McMap. All rights reserved.