release resource load by Assembly.Load

  • Thread starter Thread starter Johnny Hu
  • Start date Start date
J

Johnny Hu

i have a simple update application, which compare version with server, then
download new version from ftp server

i use
System.Reflection.Assembly.LoadFile(localfilepath).GetName().Version
to get version infomation from the main assembly

but i found i cannot delete the file before download new version after use
the code above
as i tried, Assembly type is not disposable
and GC.Collect() doesn't help.

Q1:how can i make the delete work? or is there other way to get version
informaion with load assembly?

another question is, web service cannot return correct System.Version type.
i am using string instead which is not convenience to compare with another
version string.
Q2:any suggestions ?

regards,
 
Hi,
you can not unload an assembly. But you can unload the containing
appdomain. So, create a new appdomain, load the assembly in it, and then
unload the appdomain.

Sunny
 
Back
Top