Search code examples
windows-installeradvanced-installer

How to choose a default option when Advanced Installer try to install a program which has been installed in Windows?


I have a "setup.exe" install program and i will run it in NoneUI(silent) model in a custom Winform program.

In the normal UI model , if the same version program has been installed , the interface will display 3 options : "modify" , "repair" & "remove" . But i don't know what installer will do in the silent model , and how to choose the default option ?


Solution

  • Maintenance Operations: I am not 100% sure what you are asking, but let's try. These options "modify", "repair" and "remove" apply to products that are already installed. Collectively they are "maintenance operations".

    Modify refers to selecting what features of the installation to install or uninstall (dictionaries, SDK, help documentation, etc...). In other words you can add or remove parts of the setup - in MSI known as features (see info and links below). Repair essentially re-copies the files and settings that were originally installed once more (the exact behavior can be tweaked, it might only restore missing files or it might force overwrite everything). Remove will uninstall the product.


    Features: So the above refers to the situation when your product is already installed. Then you can repair, remove or modify. However, there is also the original installation, and you can control what features are installed during such an installation.

    Here is a screen shot of an MSI showing the features available to select for installation:

    Features

    To control what features are installed when you install silently you can make use of the ADDLOCAL property via the command line (or you can set in a transform):

    msiexec.exe /I /L*V "C:\test.log" ADDLOCAL="FeatureName,AnotherFeatureName" /QN
    

    Quick Parameter Explanation:

    /I = run installation sequence
    /L*V = "C:\Test.log"= verbose logging
    ADDLOCAL="FeatureName,AnotherFeatureName" = Install these features locally 
    /QN = run completely silently
    

    There is a whole family of properties related to ADDLOCAL - such as REMOVE, ADVERTISE, REINSTALL, but most of the time ADDLOCAL will be enough to select what features to install.


    The above screenshot is from an old answer of mine on superuser.com: Automatically select features for silent MSI install. It contains some more fleshed out explanation on features and silent installation.

    There is also an answer here which describes installation and the use of command line and transforms. It is rather elaborate and excessive, but here is the link anyway: How to make better use of MSI files (note that this answer took on a strange turn when writing, so only the top half applies to your topic - the latter became a weird discussion of MSI problems in general).