简体   繁体   中英

c# on windows updating a program while it's still running

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.

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?

Wouldn't ClickOnce be a better option here?

http://msdn.microsoft.com/en-us/library/t71a733d.aspx

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

The UI is running as the logged on User.

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.

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.

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

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