Getting two different GUIDs for an Assembly

隐身守侯 提交于 2019-12-12 03:42:27

问题


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.GUI‌D.ToString() & "}"

Why GUID and GUID2 aren't the same value ?

Edit : here, binpath leads to a (COM Visible) .NET dll


回答1:


GetAssemblyName(binpath).GetType.GUI‌D.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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!