guid retrieval of assembly

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

Is there anyway to retrieve the GUID code of an assembly for use in the
application as a unique identifier? thanks!
 
Dim a As Reflection.Assembly =
Reflection.Assembly.LoadFrom("fileLocationGoesHere")
Dim i As Integer, guid As String
For i = 0 To a.GetCustomAttributes(False).GetUpperBound(0)
Dim obj As Object = a.GetCustomAttributes(False).GetValue(i)
If TypeOf (obj) Is System.Runtime.InteropServices.GuidAttribute Then
guid = CType(obj,
System.Runtime.InteropServices.GuidAttribute).Value
End If
Next
 
thanks! that worked good

Scott said:
Dim a As Reflection.Assembly =
Reflection.Assembly.LoadFrom("fileLocationGoesHere")
Dim i As Integer, guid As String
For i = 0 To a.GetCustomAttributes(False).GetUpperBound(0)
Dim obj As Object = a.GetCustomAttributes(False).GetValue(i)
If TypeOf (obj) Is System.Runtime.InteropServices.GuidAttribute Then
guid = CType(obj,
System.Runtime.InteropServices.GuidAttribute).Value
End If
Next
 
Back
Top