Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 6

Force file overwrite in Basic MSI install

Hi all,
I'm working on a very large Basic MSI install.
This install has about 50 components 20 features and over 13,000 files.
These files are mostly data files and compiled business basic files. The files do not have versions. When running our install over an old install it will fail to overwrite many files because it finds them and they do not have versions and may be modified or the hash does not match.

Now I know if I have a staticly linked file I can right click it and check the box to force overwite but the files are not all staticly linked and to do that to 13,000 files would take forever plus be a pain to manage. How can I force the MSI installer to always overwrite a file no matter what?

Labels (1)
0 Kudos
(3) Replies
Level 10

When running our install over an old install...

Am I right in thinking that you are trying to perform a minor upgrade?
And you have dynamically linked files, which are a pain to handle with a minor upgrade.
You need to remember that you cannot remove files when doing a minor upgrade, unless you author the RemoveFile table.

The problem is that you don't have a good control over components and files when using dynamic links.
So what you need is a major upgrade.
Here are some useful resources:

A part from that, I understand you have a problem with the number of resource files. One good practice would consist of packing all these resources in one or more DLL's, if these are not resources that users should be able to modify.
It has some advantages:

  • You have only a few resources DLL instead of thousands of single resource files.
  • Your resource DLL can then be versioned.

Finally, a dirty workaround to force all files to get overwritten is to set the REINSTALLMODE property to "amus" or "vamus" when performing a minor upgrade, but it won't remove files that existed in the previous package and no longer exist in the upgrade package. So to me, that's a no go!
0 Kudos
Level 6

I should have been more clear on the install over old install part.
Our old installs were done with installscript so this is our first MSI version. So when I say install over the old install what is really happening is the new install is running like a new install and the user is pointing it to the directory where the old install was. The expected behavor is to have the new install put down all the new files and replace everything.

When we were using installscript we would just set out component groups to always overwrite and this worked great.

So we are not running in upgrade mode and we are not running in any maintiance modes, we are just running like it is a new install.

0 Kudos
Level 10

What you need to do is a sort of hybrid major upgrade:
  • Detect if the previous InstallScript-based version is installed.
  • If it is installed, deinstall it.
  • Install the new version.

    Here is how I would implement it:
  • Detect if the previous InstallScript-based version is installed. I don't think there is a method like MsiGetProductInfo for InstallScript-based installed products. So, you could use a System Search instead. There are many traces of the previous installation you could search for:

    • "[ProgramFilesFolder]\InstallShield Installation Information\{OldProductCode}\Setup.exe", for instance.
    • Or search for registry keys/values in "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{OldProductCode}".

    You need to store the value of "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{OldProductCode}\\UninstallString" in a property, let's call it "UNINSTALL_PREVIOUS_PRODUCT_COMMAND".
  • Insert a "RemoveExistingInstallScriptInstallation" CustomAction just before or just after RemoveExistingProduct. This new CustomAction will use the UNINSTALL_PREVIOUS_PRODUCT_COMMAND property to start the deinstallation.
  • Install the new version. There is nothing special to do, this will be done by the rest of the sequence you already have.

    The procedure above assumes that the deinstallation of your previous version works.
    One more point: the deinstallation of the previous product won't be rollback-able.
  • 0 Kudos