Only install a subset of files if a file is newer

Got a problem you cannot solve? Try here.
amolago
Posts: 16
Joined: Wed Oct 29, 2014 9:15 pm

Only install a subset of files if a file is newer

Postby amolago » Wed Oct 29, 2014 9:26 pm

Hi,

I have a bunch of files common to a few installers. One the files is a DLL, which contains a version number, but the other file do not.

What I would like to do is test if the DLL is currently installed and if so test if the DLL file is newer/older than the one about to be installed. If the existing DLL is older, go ahead and install all the new files, otherwise don't install any of them.

I've thought of "Get File Version" and "Check File Version", but the files need to already be present on the system. However, in this case, one is still residing somewhere within the installation package, so I can't get that file's version.

I thought that I could install the file to a temp folder and then use the above, then delete it, but of course the "Install Files" action is not immediate, so the above still fails as the file isn't there yet.

I've used InstallShield in the past and within that I can query the MSI File Table to get the file version. Can such a thing be done with IA?

Can I somehow get the version of the DLL injected in to the MSIcode at build time, i.e. have the build system get the file version and call the IA builder with MYDLL=1.2.3.4?

Any other suggestions?

Amo

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Only install a subset of files if a file is newer

Postby FrancescoT » Fri Oct 31, 2014 12:56 pm

Dear Amo,

you can search for that file within the temporary folder where the extracted setup files are stored (I'm assuming you are using a compressed exe).

The temporary folder can be retrieved from the value of "EXEDIR" and "ROOTDIR" pre-defined variables.
To retrieve the path where the file is temporary stored use the "Find All Files" command.
For more information about the above pre-defined variable and the "Find All Files" command, please consult the InstallAware documentation.

Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

amolago
Posts: 16
Joined: Wed Oct 29, 2014 9:15 pm

Re: Only install a subset of files if a file is newer

Postby amolago » Thu Nov 20, 2014 12:08 am

Hi Francesco,

Excellent, thanks. :)

I then had another small issue though, the version info was not obtained from the to-be-installed DLL. I put in a debugging prompt which showed the following:

---------------------------
DEBUG
---------------------------
"C:\Users\tester\AppData\Local\Temp\7zS291F.tmp\data\MyApp\69FC0A7E\5417B2A7\TestedDll.dll"
0.0.0.0
C:\Program Files (x86)\Common Files\\MyCompany\MyApp\DLLs\TestedDll.dll
1.4.0.42
FALSE
---------------------------
OK
---------------------------

At the time of testing is was the same DLL file so I didn't know why the version would be 0.0.0.0. I looked at the file properties of the temporary file, and it was definitely 1.4.0.42.

The only difference I would see was the "" surrounding the first path name. So I tested this by adding quotes to the second file name and then it had the same problem.

So I managed to fix this up using a "Replace String" to remove the quotes, but I wouldn't have thought quotes around a path name should cause an issue!?

Anyway, I'm up and running now, but I thought I should point out the above.

Cheers
Amo

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Only install a subset of files if a file is newer

Postby FrancescoT » Thu Nov 20, 2014 12:43 pm

Dear Amo,

yes, it can be an error caused by the surrounding quotes.
Very probably because other additional quotes are added by the Get File Version command.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 66 guests