I need to update my executable with also the dll linked..

I've read about the AppDomainSetup.ShadowCopyFiles but I'm in trouble trying the right steps to do what I need

the question are:

  • the shadow copy I need to create only when I notify an update or each time I launch my executable?
  • what is the right step to copy and update the dlls and the .exe?
有帮助吗?

解决方案

Creating a shadow copy is not going to update your application. The general sequence of auto-updating requires a third application that manages the process. It looks something like this.

  1. Main application finds update and downloads update files to temp location
  2. Main application launches updater application and terminates itself
  3. Updater application copies update files over main application files
  4. Updater application launches main application and terminates itself

Obviously there is going to be error handling logic built in to this. But that is the general idea. Shadow copies are nowhere in there.

其他提示

Making use of the shadow copy feature of .NET is not a bad idea. It will allow you to update your assemblies without having to exit the application BUT you will need to restart the application in order to run the updated version. Shadow copy will simply allow you to overwrite the assemblies and nothing else.

Note that you cannot enable shadow copy on the default AppDomain. This means that you will need a loader that will create the AppDomain, and execute your application. Have a look at this answer for the steps you need to take and for a simple implementation.

If all you want to do is allow updates to be installed without having to exit the application then this is the simplest approach I can think of.

You should also have a look at Microsoft's ClickOnce technology. It solves a lot of the common problems of deploying and updating .NET GUI applications.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top