O
Oenone
I have an application which loads plugin DLLs from various directories on
the local disk. To avoid problems with the DLLs being locked by IIS, I have
modified my code so that it copies the DLLs to the /bin/ directory if it
determines that they are newer than the version already there, and loads the
copy. This then takes advantage of Shadow Copying, so the DLLs never get
locked.
This is all fine, but the very first time I put a new DLL into one of the
source directories, that page execution still runs the old code, despite it
having copied the new version to the /bin/ directory before loading the
assembly. I am guessing that this is because when I tell Assembly.LoadFrom
to load the assembly, it actually loads it from the Shadow directory, not
directly from the /bin/ directory. I guess further that the Shadow directory
is not updated with the new /bin/ DLLs until the current page request has
completed.
Is there any way I can get the first page request to load the updated
assembly rather than the old shadowed version? Perhaps some way to force (in
code) the shadow directory to refresh itself so that the updated DLL is
immediately available to be loaded?
TIA,
the local disk. To avoid problems with the DLLs being locked by IIS, I have
modified my code so that it copies the DLLs to the /bin/ directory if it
determines that they are newer than the version already there, and loads the
copy. This then takes advantage of Shadow Copying, so the DLLs never get
locked.
This is all fine, but the very first time I put a new DLL into one of the
source directories, that page execution still runs the old code, despite it
having copied the new version to the /bin/ directory before loading the
assembly. I am guessing that this is because when I tell Assembly.LoadFrom
to load the assembly, it actually loads it from the Shadow directory, not
directly from the /bin/ directory. I guess further that the Shadow directory
is not updated with the new /bin/ DLLs until the current page request has
completed.
Is there any way I can get the first page request to load the updated
assembly rather than the old shadowed version? Perhaps some way to force (in
code) the shadow directory to refresh itself so that the updated DLL is
immediately available to be loaded?
TIA,