为装配体获取两个不同的GUID [英] Getting two different GUIDs for an Assembly

查看:233
本文介绍了为装配体获取两个不同的GUID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让这段代码:

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() & "}"

为什么GUIDGUID2的值不同?

此处,binpath导致一个(COM可见).NET dll

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

推荐答案

GetAssemblyName(binpath).GetType.GUI‌D.ToString()

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.

这篇关于为装配体获取两个不同的GUID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆