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
 

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

Back
Top