ProductVersion bug?

Feb 14, 2011 at 7:52 PM
Edited Feb 14, 2011 at 9:35 PM

Hello,

I tried ResourceLib on some exes and it generally works, but when i check product version in windows explorer there is still old Product Version value, although when i check it from C# using FileVersionInfo the major, minor, build and private values are correct. Example. Changing PV from 1.2.3.4 to 11.22.33.44 (in brackets "splitted" number as showed by FVI):

Old: 1.2.3.4 (1, 2, 3, 4)

New: 1.2.3.4 (11, 22, 33, 44)

I don't see this behaviour changing FileVersion.

Example code:

VersionResource r;
using (ResourceInfo vi = new ResourceInfo()) {
    vi.Load(path);
    r = (VersionResource)vi.Resources[new ResourceId(Kernel32.ResourceTypes.RT_VERSION)][0];
}
r.FileVersion = "1.0.0.11";
r.ProductVersion = "1.0.0.12";
r.SaveTo(path);

There was version resource only for language 0, i didn't test with other languages.

Is this a bug or i missed something?

Anyway thank you for a great library.

 

EDIT:: Hmm.., according to FVI neithr FileVersion nor ProductVersion strings has changed (version parts for both are correct). Seems like explorer build FileVersion using all 4 version parts ignoring FileVersion attribute saved as a string, but for ProductVersion it uses a whole string ignoring version parts. Anyway it would be nice if ResourceLib could update strings. I suppose thet only reason of not updating version string is fact, that there can be no enough space if new version string is longer. So, it is rather not RL bug as i thought, but indended behaviour. Thread closed.

Coordinator
Feb 15, 2011 at 7:01 PM

ResourceLib can update strings, just not automatically when you update the version resource ;)

Feb 16, 2011 at 8:34 PM

Ive iterated all resources in exe and there is ony 2: manifest and version, both language 0. In manifest there was old version number (1.0.0.0):

RT_MANIFEST: Lang=0, MType=CreateProcess, size=490
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><assemblyIdentity version="1.0.0.0" name="MyApplication.app" /><trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"><security><requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"><requestedExecutionLevel level="asInvoker" uiAccess="false" /></requestedPrivileges></security></trustInfo></assembly>

so i've replace it with 1.0.0.1 and saved but nothing changed in explorer, still showing 1.0.0.0 (it have been replaced, i've chaked)

In version is this:

RT_VERSION: fv=1.0.4062.42043, hdr=(VS_VERSION_INFO: wl=696, wt=0, wv=52), lang=0, pv=1.0.4062.42043, size=696
 VarFileInfo=(VarFileInfo: wl=68, wt=1, wv=0)
 StringFileInfo=(StringFileInfo: wl=536, wt=1, wv=0)

First - resource, below resources collection. I couldn't find any string with value "1.0.0.0".

What i'm missing?

Coordinator
Feb 17, 2011 at 3:35 PM
Edited Feb 17, 2011 at 3:35 PM

For explorer to pick this up you need a ProductVersion string resource I think. See my old article in http://www.codeproject.com/KB/library/ResourceLib.aspx under Writing Version Resource.