Logging file versions during update
Posted 08 September 2008 - 17:08
Have an Installscript project in IS 12 Pro.
Have built two lists: one with all the files in the MEDIA, and another with the files on the user file system to compare against.
Was going to loop through files in MEDIA list, find file on filesystem, get version and date, and do compare/log/etc.
Now I see the ListFindString function apparently does not find a substring in a list. The help and example for this function is unclear.
After trying some things, it seems the string has to be an exact match to an element in the list.
So if I am searching for a file random.exe in the media, when it checks against c:\program files\company\sub folder\random.exe, it does not count as a string.
- Does anyone know of a simpler way to compare a file from install media against the target file on the hard drive it would likely be updating, via some variable or such? Installshield obviously uses the 'Destination" from the component and knows where to put it, but it does not appear to me the Destination field is available to the developer.
- Is there a function that will find a substring in a list? (it does not seem like it). I am about ready to make another 2 lists of files only (no paths) from the MEDIA and hard drive. I'll then do search on file against files (instead of file against path/file) which will give me the index so I can go against my main lists (of path/files) to do the actual version/date compare.
Wow, that was a mouthful. At least I understood that - maybe someone else will.
Posted 09 September 2008 - 07:55
and Companions? (VerProductCompareVersions, VerCompare etc.) ? As far as I understand your posting this should do.
Posted 09 September 2008 - 19:29
In other words, it looks like they would compare an App V3 (already the system) against App V3.1 (recently built into new install media), and see there is a newer version available.
I am working on using the VerGetFileVersion and FeatureFileEnum functions now to get a version of a file on the user's hard drive and contained in the install MEDIA, respectively.
The problem is: I cannot find any way to know the variable name for or how to reference the path_and_file_already installed when I am working with the file from the MEDIA.
In other words:
Let's say I have SOFTWARE\ORACLE X complete\Services\First\main.exe
It is contained in a list, along with all other files in the MEDIA separated by Setup type, feature, component, and file.
Now, I want to compare against main.exe on the hard drive.
I have a file called main.exe in a list of all files on the hard drive, but it appears as:
drive:\program files\company\application\sub application\main.exe
I do not know how to compare main.exe form within the MEDIA against this file on the hard drive without (for example), calling VerFindFileVersion on each file in the MEDIA which would hit the user's file system for each file, and then compare the "new" and "current" versions.
This would probably work, however I suspect this would be poor performance.
I already have a list of all paths and files I built which I created by a routine that finds all files of a certain filemask in certain folder I care about (have installed files from the application within).
I know an MSI-based project does logging like this already, but provides little flexibility for some things we want to do.
We want the installer to log the file versions that were on the system against the new versions.
I wish there was something like a variable containing the "Destination" folder from the Component properties area.
I know TARGETDIR is available, but the Destination is normally a folder composed of TARGETDIR plus other folders.
Thanks for the reply, and thanks in advance for any other ideas.
Posted 10 September 2008 - 08:35
If you want to make sure that only newer files are installed - that's a component property. You can specify whether you want your files to be overwritten always, only when newer by timestamp, only when newer by version or never.
Just sort your files into components with appropriate overwrite settings and InstallShield is taking care of it all.
In case you need the versions anyway - you do know the folder structure of your TARGETDIR, don't you? So you can loop through all the subfolders of interest to you.
Or you could define your own path variables. For an example how to do and use that see
As for logging versions: Marketing demanded that we should write a text file with dll- and exe-file versions at the end of each setup, which is quite silly as we know exactly what versions belong to each of our product versions. Luckily I found some tool written long ago which extracts all file version info from a given folder. I just had to add command line ability and now i run it at the end of each setup. Such a tool is not too difficult to write, maybe you can persuade your programmers to write a command line tool which meets your needs.
Posted 10 September 2008 - 17:30
We release patches sometimes to customers test servers before that are truly "production" (passed integration testing) is the customer wants them right away and understands the risks.
When a new full release is available, our support group sometimes wants to know the "before" and "after." Obviously the "after" is easy to get, but I do agree a log like I'm working on would be helpful in some cases.
Because of this and other reasons, I have a task to create a log of versions of DLLs and EXEs, similar to what you mentioned.
Conceptually, it seems easy, but with Installscript it has proven quite tedious.
Thank you for the info. This may be useful.
We have several different truly "target" folders containing different services and INI files. They are all under different folders which makes this more irritating to code (mainly from a performance standpoint - I don't want to search the hard drive over and over to find the current service on the filesystem, but I may end up doing that).