Checking for the public key on a assembly
C#
2
Posts
2
Posters
0
Views
1
Watching
-
Does any one know how to check by code the public key on an assembly that I am loading. - Tariq
This is untested code, but it follows the example shown at
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemReflectionAssemblyNameClassGetPublicKeyTopic.htm
.using System.Reflection;
public byte[] GetPublicKey(string assemblyFilename)
{
AssemblyName assemblyName = AssemblyName.GetAssemblyName(assemblyFilename);return assemblyName.GetPublicKey(); // For the token you can use // return assemblyName.GetPublicKeyToken();
}
Sorry for the bad formatting, it appears that the pre tag isn't being very pre like :) HTH, James Sonork ID: 100.11138 - Hasaki "Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. :-D" - Michael P Butler Jan. 18, 2002