Win32 version info

I compile about ten VC++ 2005 projects using the "Build VS.net solution" with the option to set the file version with a property set. On nine of the projects it works perfectly. But on one it just doesn't update the version info. And I can't figure out why that is.

In the log it says "Win32 Version Info updated" while for the ones that it actually works it says "Updating Version info in file : C:\blah\blah.rc" just before.

I'm using FinalBiulder 5. In the release notes for FinalBuilder 6 I read something about a fix for Win32 version numbers. Is it this problem, or is there something I can do to make it work with FB5?

 

Rgds

Richard

This suggests to me that FinalBuilder didn’t detect which .rc file had the VERSIONINFO in it. If your project doesn’t already have a .rc file which includes a VERSIONINFO record then FinalBuilder will not update it.

Hi Vincent,

the .rc file has even the same name as the .vcproj and the containing directory. That’s not true for all the other projects.
I compared the .rc files for quite a while, and couldn’t find anything that would explain the behavior.
The .rc file in question contains nothing but the version info, while most others also have dialogs and other stuff.

In the project file, the file had some explicit configurations for the MSVC resuorce compiler. Removing them didn’d change anything.

For the moment, I solved it with a small JavaScript:


var versionstr = VersionToBuild;
versionstr = versionstr.replace(".", “,”);
versionstr = versionstr.replace(".", “,”);
versionstr = versionstr.replace(".", “,”);
var fso = new ActiveXObject(“Scripting.FileSystemObject”);
if(fso.FileExists(PL20SOURCEDIR + “\ha_bridge\ha_bridge.rc.new”))
fso.DeleteFile(PL20SOURCEDIR + “\ha_bridge\ha_bridge.rc.new”);
var filein = fso.OpenTextFile(PL20SOURCEDIR + “\ha_bridge\ha_bridge.rc”, 1, 0);
var fileout = fso.OpenTextFile(PL20SOURCEDIR + “\ha_bridge\ha_bridge.rc.new”, 2, 1);

while(!filein.AtEndOfStream)
{
var line = filein.ReadLine()
var linetrim = line;
// trim left
linetrim = linetrim.replace(new RegExp("^[\s]+", “g”), “”);

if(“FILEVERSION” == linetrim.substr(0, 11))
line = " FILEVERSION " + versionstr;
if(“PRODUCTVERSION” == linetrim.substr(0, 14))
line = " PRODUCTVERSION " + versionstr;
if(“VALUE “FileVersion”” == linetrim.substr(0, 19))
line = " VALUE “FileVersion”, “” + versionstr + “\0"”;
if(“VALUE “ProductVersion”” == linetrim.substr(0, 22))
line = " VALUE “ProductVersion”, “” + versionstr + “\0"”;

fileout.WriteLine(line);
};
filein.Close();
fileout.Close();
fso.DeleteFile(PL20SOURCEDIR + “\ha_bridge\ha_bridge.rc”);
fso.MoveFile(PL20SOURCEDIR + “\ha_bridge\ha_bridge.rc.new”, PL20SOURCEDIR + “\ha_bridge\ha_bridge.rc”);

Action.SendLogMessage("succesfully set file version to " + versionstr + " in " + PL20SOURCEDIR + “\ha_bridge\ha_bridge.rc”);


Rgds
Richard

Hi Richard

If you send us your vcproj file, and the .rc file I can dummy it up so I can step through it in the debugger and see why it’s not finding the version info block.