I use my own .rc file to generate custom resource entries including version info.
My library.rc file is :
#include "app.rc.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION _FileVersion
PRODUCTVERSION _FileVersion
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1252
END
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "InternalName", App_InternalName "\0"
VALUE "CompanyName", App_CompanyName "\0"
VALUE "FileDescription", App_ProductName "\0"
VALUE "FileVersion", _FileVersionStr "\0"
VALUE "ProductName", App_ProductName "\0"
VALUE "ProductEdition", App_ProductEdition "\0"
VALUE "LegalCopyright", "Copyright \251 " App_CompanyName "\0"
VALUE "CompanyURL", App_CompanyURL "\0"
VALUE "ProductURL", App_ProductURL "\0"
VALUE "SupportURL", App_SupportURL "\0"
VALUE "AppRegistryPath", App_RegistryPath "\0"
END
END
END
I add the .rc file into the package project file via Project | Add to Project. My package.dpk file is something like this so far:
package SQL.Alpha.resource.core;
{$R *.res}
{$R 'library.res'}
{$ALIGN 8}
The package.dproj file has RcCompile entry:
<RcCompile Include="..\..\build\rc\library.rc">
<Form>library.res</Form>
</RcCompile>
When I compile the package, everything looks good but it has a warning:
[DCC Warning] W1056 Warning: Duplicate resource: Type 16 (VERSIONINFO), ID 1; File library.res resource kept; file package.res resource discarded.
This is due to the package itself generate it's own package.res file that include MainIcon and VersionInfo entries. And the VersionInfo has conflict with my own VersionInfo entry.
I then attempt to remove {$R *.res} in the dpk file:
package SQL.Alpha.resource.core;
{$R 'library.res'}
{$ALIGN 8}
Rebuild the project and everything works fine. The warning is gone.
However, there are some side effects removing {$R *.res} manually:
- Delphi IDE will add the {$R *.res} again if you attempt to add new unit in package or make and changes in Project | Options...
- All RcCompile entries in .dproj file will be removed
I can tolerate with first side effect by removing {$R *.res} again in package.dpk file.
However, the 2nd side effect is out of my control. The missing RcCompile in package.dproj will cause the rc file not to compiled by brcc32 again. Removing the .res files in file system will cause error in compilation due to this.
Does anyone has ideas how to overcome this problem? Thank you.