Self-updating / shadow copy using Asp.Net kernel

I am writing an Asp.Net Core application that should be able to update itself (replace its own executables while running).

This MSDN article describes shadow copying with a classic .Net map, which would be exactly what I need. But the whole AppDomain thing is missing from .Net Core.

So my questions are:

  • Is there an alternative way in .Net Core to enable shadow copying of assemblies?
  • Are there other mechanisms in .Net Core that allow you to create a self-updating application?
+5
source share
2 answers

Since there is no built-in mechanism for the .NET Framework, I eventually implemented my own solution. It works something like this:

  • The downloadable application downloads and extracts the new binaries to a new folder.
  • A running application starts a small update process. The following parameters are passed to the update process through the command line:
    • Running process id
    • The binary path of the running application
    • Path of downloaded binaries
  • A running application goes wild.
  • The update process waits until the running application terminates (using the process identifier), or decisively kills the running application if it does not exit within the specified timeout.
  • The upgrade process deletes existing binaries and copies the new downloaded executables.
  • The upgrade process launches a new version of the main application.

Make sure that you do as much as possible in the main application (download, unpack, check, ...) and keep the update process as simple as possible (minimizing the risk of failure).

This approach has been quite stable.

+1
source

.NET Core has no built-in shadow copiers

+4
source

Source: https://habr.com/ru/post/1265422/


All Articles