简体   繁体   中英

MSI installer runs again after already having installed using msiexec

I have an windows service running that updates another windows service. It does this by uninstalling the currentversion and then installing the newer one. We do this using the original msi installers and msiexec with Process.Start().

Process msiexec = new Process();
msiexec.StartInfo.FileName = "msiexec";
msiexec.StartInfo.Arguments = "/quiet /i \"" + msiFileName + "\" /l*v \"" + msilogfile + "\"";

if (!msiexec.Start())
....etc... error handling code and such...

Uninstalling goes fine, so thats no problem. Installing, seems to go fine as well. I output the msi install log. And in the log, it says it succesfully installed.

I then reboot the computer, and on startup, Windows itself runs the installer again? It then complains that the service already exists of course and it all breaks...

What could be the reason that Windows decides to run the installer at startup?

Important to note here: If I manually install the new version, it works and windows does not try to install it on startup. So it has to do with msiexec maybe? Some permission thing?

This is probably a repair. Check the Application Event Log for MsiInstaller entries that mention missing components. It'll happen if Windows thinks the installed product is damaged.

I suspect the reason you see the error about the service already installed is that you are using an Installer class custom action to install the service, and it will run again on repair and give you the error about already installed. You'd see the same "already installed" error if you right-clicked the MSI and chose repair, or did repair from Programs&Features.

To prevent this add a condition of Not Installed to the install custom action that installs the service, then it will run only on an install and not on a repair.

You either miss a registry entry at the location it is pointing you to, or your applications shouldn't be looking for that registry entry in the first place.

There are a couple of ways to fix this issue, you can read about it in this article.

Let me know weather it helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM