简体   繁体   English

使用msiexec安装后,MSI安装程序将再次运行

[英]MSI installer runs again after already having installed using msiexec

I have an windows service running that updates another windows service. 我正在运行Windows服务,该服务会更新另一个Windows服务。 It does this by uninstalling the currentversion and then installing the newer one. 它通过卸载currentversion然后安装较新的版本来实现。 We do this using the original msi installers and msiexec with Process.Start(). 我们使用原始的msi安装程序和带有Process.Start()的msiexec进行此操作。

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. 我输出msi安装日志。 And in the log, it says it succesfully installed. 并且在日志中,它表示已成功安装。

I then reboot the computer, and on startup, Windows itself runs the installer again? 然后,我重新启动计算机,并在启动时Windows本身再次运行安装程序? 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? Windows决定在启动时运行安装程序的原因可能是什么?

Important to note here: If I manually install the new version, it works and windows does not try to install it on startup. 在此处需要注意的重要事项:如果我手动安装新版本,则该版本可以运行,并且Windows不会在启动时尝试安装它。 So it has to do with msiexec maybe? 因此,这可能与msiexec有关? Some permission thing? 一些许可的东西?

This is probably a repair. 这可能是修复。 Check the Application Event Log for MsiInstaller entries that mention missing components. 检查应用程序事件日志中是否有提及缺少组件的MsiInstaller条目。 It'll happen if Windows thinks the installed product is damaged. 如果Windows认为安装的产品已损坏,则会发生这种情况。

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. 我怀疑您看到有关已安装服务的错误的原因是,您正在使用Installer类自定义操作来安装服务,并且它将在修复时再次运行,并为您提供有关已安装的错误。 You'd see the same "already installed" error if you right-clicked the MSI and chose repair, or did repair from Programs&Features. 如果右键单击MSI并选择修复,或者从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! 让我知道天气有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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