I am creating a software application that is able to update itself. After the start, the application checks if there are updates avaiable, download those files (assemblies),
A simple solution would be to use Shadow Copying.
Simple example:
class Program
{
static void Main(string[] args)
{
var x = AppDomain.CreateDomain("TestAssembly", null, new AppDomainSetup() {
ShadowCopyFiles = "true",
CachePath = @"c:\tmp",
ApplicationName = "ShadowCopyTest"
});
var a = x.Load("TestAssembly"); // Load Assembly and run...
}
}
You could create an executable that would load your application (your executable users are starting right now) into a new Application Domain using Shadow Copying. CachePath
has to be user specific, e.g. the users temp directory.
This way, each user would create a copy of all assemblies loaded by your application. But you have to take care of cleaning up the copied files yourself.
All you have to do then is to ensure the application gets started by your new wrapper executable.