I recently discovered that one can copy over an assembly that is in use by renaming the file and then performing the copy. E.G.
C:\Folder\MyLibrary.dll
=> rename to C:\Folder\MyLibrary.dll_old
=> copy new version C:\Folder\MyLibrary.dll (v2.0)
I was told that the next time the application starts, it will loadup this new assembly. And while the application continues to run, it will continue to use the old assembly (even though it's renamed _old).
Seems like a hack to me. Is it safe to update assemblies in this manner?
It is safe. As long as the old assembly stays loaded, the same app domain will not be attempting to load it again. The file name is not important for continued execution of the app.
However, in production use you would probably have to think about 3+ simultaneous versions and a mechanism to remove the unused files eventually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With