How to unload the assembly?

G

Guest

I have a problem... A webservice I built check the version of an assembly by
using this code:
app = [Assembly].LoadFrom(Server.MapPath(appName & "\" & assemblyName))
' Return it's version
Return app.GetName.Version.ToString

when another app is uploading a new version of that file I get a
securityexception stating the file is in use...

The ony code i have that accesses that file is the above code... so what is
going on?

I can't unload an assembly without disposing the entire app domain...
/Henrik
 
I

Imran Koradia

To get assembly information, you would be better off using the AssemblyName
class:

Private Function GetAsmVersion( _
ByVal sAssemblyFileName As String) As String
Dim asmName = _
AssemblyName.GetAssemblyName(sAssemblyFileName)
Return asm.Version.ToString
End Function

GetAssemblyName loads the file, extracts the information and then closes
back the file. The assembly is not loaded into the app domain and so you
don't have to deal with unloading it from the app domain.

hope that helps..
Imran.
 

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