我想从 dll 中找到公共用户定义函数publickeytoken == null
OpenFileDialog obj = new OpenFileDialog();
if (obj.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
Assembly ass = Assembly.LoadFrom(obj.FileName);
// Here its getting Exception because Publickeytoken == null;
Assembly a = Assembly.LoadWithPartialName(ass.FullName);
Type[] types = a.GetTypes();
foreach (Type type in types)
{
if (!type.IsPublic)
{
continue;
}
MemberInfo[] members = type.GetMembers(BindingFlags.Public
| BindingFlags.Instance
| BindingFlags.InvokeMethod);
foreach (MemberInfo member in members)
{
Console.WriteLine(type.Name + "." + member.Name);
}
}
}
如何解决这个问题
即使我试过这个来查找 publictokenkey 它会重新运行 0 个字节
byte[] b = Assembly.GetExecutingAssembly().GetName().GetPublicKeyToken();