If you are using System.Reflection.Assembly.ReflectionOnlyLoadFile to list
the contents of directory where an assembly is loaded for your application
then you are going to have to unload the assembly loaded from that directory
before attempting to delete the directory. If this is the case then why
would you want to delete the directory.
HTH
Ollie Riches
> After using System.Reflection.Assembly.ReflectionOnlyLoadFile to look
> through a directory and inspect versions of files and such I use a
[quoted text clipped - 8 lines]
>
> AJL
goHawkeyes - 29 Jan 2007 15:14 GMT
Here is the solution I found. I didn't realize I could not easily
unload the assembly from my appDomain. One work around is below,
sorry I couldn't find the originally group link. You basically make a
copy of the file so as not to load the originally into the appdomain.
Private Function GetDllInfo(ByVal filePath As String) As DllInfo
Dim asm As Assembly
Dim dllVersionInfo As New DllInfo
Dim stream As New FileStream(filePath, FileMode.Open,
FileAccess.Read)
Dim memstream As New MemoryStream()
Dim b(4096) As Byte
While stream.Read(b, 0, b.Length) > 0
memstream.Write(b, 0, b.Length)
End While
asm = Assembly.Load(memstream.ToArray())
dllVersionInfo.DllVersion = asm.GetName.Version.ToString
dllVersionInfo.DllName = asm.GetName.Name.ToString
memstream.Close()
stream.Close()
Return dllVersionInfo
End Function
Public Class DllInfo
Dim version As String
Dim name As String
Public Sub New()
End Sub
Public Property DllVersion() As String
Get
Return version
End Get
Set(ByVal value As String)
version = value
End Set
End Property
Public Property DllName() As String
Get
Return name
End Get
Set(ByVal value As String)
name = value
End Set
End Property
End Class
> If you are using System.Reflection.Assembly.ReflectionOnlyLoadFile to list
> the contents of directory where an assembly is loaded for your application
[quoted text clipped - 18 lines]
>
> > AJL- Hide quoted text -- Show quoted text -