|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Using shadow copy in a standalone exeI am tryng to enable shadow copying on a standalone executable. What I need to do is to install upgrades while the application is running. I do not need to upgrade the executable, only the assemblies it refernces. I cannot use click once because - as I described in a previous post - it gives me to control and information over the files that are being downloaded. I have created a custom web service and everything works fine until I try to upgrade an assembly that is allready running. I thought of shadow copying my assemblies but the MSDN documentation on this matter sucks. I found some posts on the web of people trying to achieve the same thing but no helpful respones. Any help and (verified to be working) code samples would be greatly appreciated. Thanks! Hello Strider,
On Win2003 shadow copying is supported by windows, and you can call disk properties and turn ShadowCopy on. By I'm not sure if it helps - try it first Another way is to use AppDomainSetup.ShadowCopyFiles (.NET 2.0) to tune CLR makes ShadowCopy of you domains S> Hello all, S> S> I am tryng to enable shadow copying on a standalone executable. What S> I need to do is to install upgrades while the application is running. S> I do not need to upgrade the executable, only the assemblies it S> refernces. S> S> I cannot use click once because - as I described in a previous post - S> it gives me to control and information over the files that are being S> downloaded. I have created a custom web service and everything works S> fine until I try to upgrade an assembly that is allready running. S> S> I thought of shadow copying my assemblies but the MSDN documentation S> on this matter sucks. I found some posts on the web of people trying S> to achieve the same thing but no helpful respones. S> S> Any help and (verified to be working) code samples would be greatly S> appreciated. S> S> Thanks! S> --- WBR, Michael Nemtsev :: blog: http://spaces.msn.com/laflour "At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche Thanks for your reply Michael.
I finally managed to launch my application from within my application into a new AppDomain that supports shadow copying. Here's the code: [STAThread] static void Main() { if (AppDomain.CurrentDomain.FriendlyName != m_sSHADOW_APPDOMAIN) _CreateShadowCopyDomain(); else _RunApplication(); } private static void _CreateShadowCopyDomain() { AppDomain oCurrentDom = AppDomain.CurrentDomain; AppDomainSetup oDomSetup = new AppDomainSetup(); oDomSetup.PrivateBinPath = oCurrentDom.SetupInformation.PrivateBinPath; oDomSetup.PrivateBinPathProbe = oCurrentDom.SetupInformation.PrivateBinPathProbe; oDomSetup.ApplicationBase = oCurrentDom.SetupInformation.ApplicationBase; oDomSetup.ShadowCopyDirectories = oCurrentDom.SetupInformation.ApplicationBase; oDomSetup.ShadowCopyFiles = "true"; AppDomain oNewDom = AppDomain.CreateDomain(m_sSHADOW_APPDOMAIN, oCurrentDom.Evidence, oDomSetup); oNewDom.ExecuteAssemblyByName(Assembly.GetEntryAssembly().FullName); } private static void _RunApplication() { // Place the code that would normally be located inside the Main // function here. } One should not place inside the Main function any references to types implemented in referenced assemblies because this would cause these assemblies to be loaded and locked before shadow copying is enabled. Show quote "Michael Nemtsev" wrote: > Hello Strider, > > On Win2003 shadow copying is supported by windows, and you can call disk > properties and turn ShadowCopy on. > By I'm not sure if it helps - try it first > > Another way is to use AppDomainSetup.ShadowCopyFiles (.NET 2.0) to tune CLR > makes ShadowCopy of you domains > > S> Hello all, > S> > S> I am tryng to enable shadow copying on a standalone executable. What > S> I need to do is to install upgrades while the application is running. > S> I do not need to upgrade the executable, only the assemblies it > S> refernces. > S> > S> I cannot use click once because - as I described in a previous post - > S> it gives me to control and information over the files that are being > S> downloaded. I have created a custom web service and everything works > S> fine until I try to upgrade an assembly that is allready running. > S> > S> I thought of shadow copying my assemblies but the MSDN documentation > S> on this matter sucks. I found some posts on the web of people trying > S> to achieve the same thing but no helpful respones. > S> > S> Any help and (verified to be working) code samples would be greatly > S> appreciated. > S> > S> Thanks! > S> > --- > WBR, > Michael Nemtsev :: blog: http://spaces.msn.com/laflour > > "At times one remains faithful to a cause only because its opponents do not > cease to be insipid." (c) Friedrich Nietzsche > > > |
|||||||||||||||||||||||