问题
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 ?
回答1:
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:
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).
回答2:
The overall issue is that running the setup and MSI again won't do anything useful, so it's not clear what you want to achieve.
If you wanted to uninstall you wouldn't run the MSI again, you'd just uninstall it.
If you wanted to repair the installed product, you wouldn't run it again. Why does it need repair? In any case it will repair based on shortcut resiliency actions, so it doesn't seem useful.
If you want to add features with a modify, then this is typically run in UI mode to choose the features.
So the general question I have is: What's the actual problem you're trying to solve? There doesn't seem to be any indication of what you're trying to achieve, and the silent install you're doing basically doesn't do anything except a default maintenance mode, probably repair.
来源:https://stackoverflow.com/questions/52771522/how-to-choose-a-default-option-when-advanced-installer-try-to-install-a-program