C#的Windows更新程序,同时它仍在运行程序、Windows

2023-09-06 18:29:13 作者:人生如梦光阴如箭i\]

我在与相关服务,更新由定期检查网站对MSI的较新版本的程序亭的程序。如果找到一个,它会安装,该程序可能仍在运行。

I have a program on a kiosk with an associated service that updates the program by periodically checking on the web for a newer version of the MSI. If it finds one, it will install it, the program may still be running.

要解决上述溶液的DLL冲突,我重命名​​MSI的组件与版本,所以新版本可以在旧的运行安装。该应用程序将轮询安装目录的新版本组件,如果找到重新启动一次,只要它不被使用。有没有更好的办法来做到这一点?

To get around the DLL conflicts of the above solution, I rename the assemblies in the MSI with by version so a new version can install while the old is running. The application will poll the install directory for newer version assemblies and if it finds one restart as soon as it is not being used. Are there any better ways to do this?

推荐答案

我以前做过这个故事。它的工作原理是这样的:

I've done this story before. It works like this:

用户界面运行作为登录的用户。

The UI is running as the logged on User.

该服务正在运行的系统。该服务检查的内容,并下载到一个临时目录。它使用/ JM命令则通告MSI。安装程序现在可以通过该非具有优越的用户安装。

The service is running as System. The service checks for content and downloads it to a temp directory. It then advertises the MSI using the /JM command. The installer can now be installed by the non-priviledged user.

该服务发送一个IPC消息应用程序说,它的时间来安装。该应用程序揭开序幕安装程序传递给它一个标志,指示重新启动应用程序。该应用程序的退出解除锁定的文件。

The service sends an IPC message to the application saying that it's time to install. The application kicks off the installer passing it a flag that indicates to restart the application. The application the quits releasing the locked files.

在安装结束时,标志使安装程序重新启动应用程序。

At the end of the installer the flag causes the installer to relaunch the application.

另外看看在 wuw4库 。它有助于创造了很多这样的解决方案。

Also take a look at the wuw4 library. It helps in creating a lot of this solution.