问题
Let this piece of code :
Dim GUID as String
Dim GUID2 as String
GUID = "{" & _
System.Reflection.Assembly.LoadFrom(binpath). _
GetCustomAttributes _
(GetType(Runtime.InteropServices.GuidAttribute), _
True)(0).Value.ToString.ToUpper & "}"
GUID2 = "{" & _
Reflection.AssemblyName. _
GetAssemblyName(binpath).GetType.GUID.ToString() & "}"
Why GUID and GUID2 aren't the same value ?
Edit : here, binpath leads to a (COM Visible) .NET dll
回答1:
GetAssemblyName(binpath).GetType.GUID.ToString() returns the GUID for the Type; it's the same as typeof(AssemblyName).GUID (in C#; I don't know how to write that in VB.NET), which is probably not what you wanted.
来源:https://stackoverflow.com/questions/39391655/getting-two-different-guids-for-an-assembly