2

In InstallShield, it allows us to overwrite files with "Newer version then newer date" rule. Can anyone tell me it is possible to implement such a function in Advanced Installer? Thank you!

user2051823
  • 177
  • 1
  • 7
  • 23
  • Those are actually Windows Installer rules not InstallShield rules. Also that's not an accurate description of the process. For more information see: http://msdn.microsoft.com/en-us/library/windows/desktop/aa368599(v=vs.85).aspx – Christopher Painter Aug 06 '13 at 20:06
  • "Newer version then newer date" was at least one rule of the InstallShield (V3.x/V5.x/V6.x/V7.x) before MSI came out :-) Stuff of the 80s/90s. I am not sure, if they survived for some legacy script project type, I don't use them (of course) :-) See my answer below. – Philm Aug 06 '13 at 21:28

3 Answers3

2

New answer by me, especially to the "equal version" problem.

Two approaches possible:

First approach: Testing! Compare the install result with the source, at least before you ship the setup. Always a good recommendation. Then beating the developers who forgot to increase their version numbers and saying "MSI is requesting you have a clean version handling. If not, your file is not overwritten over an existing older version." Have done this. Has worked. (Not necessary in first version, but in updates.)

Second approach: Use always the property REINSTALLMODE with "e". This means always override existing file with file version (file level rule only). E.g. you put in your MSI hardcoded the property "REINSTALLMODE" with value "emus". This still allows you to override it, e.g. for repair, where it should be "vemus". More clean is to set this property only in the commandline but then you need a setup.exe or other bootstrapper.

This second approach is more comfortable, but now you have losed a very clean file version handling. If you have a shared file in two different setups (products) of your company, with version 1.0, which is really older, it will be overwrite the "newer" one which has also V1.0.

If you have no shared files, it works. But you are relying now really on the version managagement of the setup update process, so it is even more important, to assure, that the product 1.1 (not the file) can not be installed over a newer product version 1.2 or 2.0 for example.

Third approach (added later):

If you only produce Major Upgrades in MSI, e.g. no patches, and you rely on the "uninstall old version before install new version" strategy (e.g. the default in InstallShield), then "normally" you will never have a situation of overinstalling files, given some conditions (like having no shared files, again). Don't use merge moduls of MS if doing this, except you are an expert.

There are not really better alternatives.

Philm
  • 3,448
  • 1
  • 29
  • 28
1

This option is not available in Advanced Installer, but you have the option to always overwrite the file existent on the machine, see Operations tab.

Bogdan Mitrache
  • 10,536
  • 19
  • 34
  • Is there a way to simulate this function in Advanced Installer? e.g. write a custom script to do the job? – user2051823 Aug 07 '13 at 09:06
  • I'm afraid not, MSI packages built with Advanced Installer follow the file versioning rules (article linked by Christopher above), you cannot amend that. – Bogdan Mitrache Aug 07 '13 at 10:16
1

I begin with the potentially best answer here: Don't care about. MSI follows here very sufficient default rules, and if they do not fit in your case it is somewhat likely that you have to change your strategy; your requirement is not best practice, dangerous, has contradictions, etc...

To go more in detail:

1) If the file has a version, just don't care about the setup. Care about the development (build/CM) process. Best is to assure, that a file version is set higher each time the file is compiled. Strange enough (too) few companies achieve that simple goal...

2) The last change date of files included in Windows installer files is not significant in MSI, and this is very good decision! Dates are normally very bad discriminators. Most interesting example is when your hotfix for V1.0 is newer than the V2.0 - yes, sometimes it is necessary to support old version lines. :-) So, forget about the date. The thumb rule is: Unversioned files are normally overwritten (with few and disctinct exceptions which you don't need to know first of all).

3) You have to tell us more detailed, what is your problem (if there is one), or what you want to acchieve other than the default behaviour??! E.g. do you have problems overwriting with "same version" or with files edited by a user after setup?

--

4) Full detail info, only if interested: In MSI the file overwriting rule is global to all files, this is a bit frightening for "old" setup/script developers, but it works, you have to change your habitations a bit.

Advanced installer is only a GUI wrapper of MSI (Windows Installer), so first you have to understand MSI a bit.

Here is the whole story of MSI file overwriting on MSDN, called "File Versioning Rules" http://msdn.microsoft.com/en-us/library/windows/desktop/aa368599(v=vs.85).aspx

As always, MS does a very accurate job in MSI documentation. This is one of the best things in MSI.. (insider joke).

If you read all subsections of that link it seems quite complicated to most people I think. Once understood, it's simple like always.

Philm
  • 3,448
  • 1
  • 29
  • 28
  • 3) The problem I am concerning is that, former developers may forget to update the version of the file after editing (e.g. a DLL file). If he fails to do so, I can still compare the modified date of the files to determine whether to overwrite or not. – user2051823 Aug 07 '13 at 10:32
  • As I said, file date is too weakly. A colleague mails the file with outlook: date is changed. Put the file on a server, sometimes the time is changing, if you copy it back. NTFS and FAT have different time resolutions, this is even more true, if Linux servers are involved. When I do patches, Windows gets confused about summertime. If you begin to collect over years, all these scenarios, it's a lot, some are strange, some are at least deterministic but not widely known. – Philm Aug 07 '13 at 16:21