Unloading and replacing an assembly

J

Jonas Bergman

I have an application that dynamically loads an assembly dureing runtime. I
want to send a mesage to the application that a new version of the assembly
is available.

I then want to unload the assembly and replace the existing file with a new
file with the same name, without exiting the application.

Is that possible??

/Jonas Bergman
 
J

John Timney \( MVP \)

Why dont you code your application to look for another file name as the
replacement assembly at regualr intervals, and when it finds the file
delete/rename the old assembly and rename the new one to the old file name.
 
?

=?iso-8859-1?Q?Lasse=20V=e5qs=e6ther=20Karlsen?=

Hello Jonas,
I have an application that dynamically loads an assembly dureing
runtime. I want to send a mesage to the application that a new version
of the assembly is available.

I then want to unload the assembly and replace the existing file with
a new file with the same name, without exiting the application.

Is that possible??

/Jonas Bergman

The assembly would have to be loaded into a different appdomain and treated
with care. If you bring the assembly into your main appdomain you can't unload
it without exiting the application instance.
 
J

Jonas Bergman

The problem is that the assembly is loaded in to the application (the
AppDomain??) and that I can't delete a file that has been used in the
application,. The file is locked.
 
O

Oleg Zherebin

To avoid assembly file locking use SetShadowCopyFiles() and
SetShadowCopyPath().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top