You received an exit code of 0
because the product is already installed and you are not attempting to install a new version. In otherwords, your MSI does not have a new Product Code and version number, therefore the MSIExec installer considers it a reconfiguration, and exits. I tested this out by turning on the /log switch and reading the output after installing one of my MSI files twice.
MSI (c) (98:EC) [15:19:27:912]: Product: Product Name -- Configuration
completed successfully. MSI (c) (98:EC) [15:19:27:912]: Windows
Installer reconfigured the product. Product Name: Product Name.
Product Version: 4.8.22. Product Language: 1033. Manufacturer: Manufacturer. Reconfiguration success or error status: 0.
If you were trying to install a new version of your product and your MSI was not configured to remove previous versions, you would receive an error code of 1638
. See list of error codes here: MSDN
If you want to check if the product is already installed with the existing MSI information (not an upgrade) you would need to check the registry at: HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstallYourProductCode
If it turns out it is installed (according to the system/registry -- maybe the files were deleted but it still is considered to be installed) you can try uninstalling it using the /x
or /uninstall switch
and then reinstalling. You could also use the /fa
switch to do a repair and reinstall all files.
msiexec.exe /x ProductCode
will uninstall it. Then you can run the install again after that.
msiexec.exe /fa ProductCode
will do a repair of all files. The /f switch has a lot of different options for how it reinstalls files, so you'd do well to read the link to the msiexec switches article I posted above.
Some other notes about msiexec:
/qb
displays a basic user interface. You probably want /qn
.
When I was setting up my live-update software I ran into a bunch of problems, I had to make sure I called msiexec from system32 by using
p.StartInfo.FileName == Path.Combine(System.Environment.ExpandEnvironmentVariables("%windir%\system32"), "MSIExec.exe");
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…