Reputation: 886
I need to get a dll public key token. I know that that is possible by loading the dll and getting that information:
Assembly.GetExecutingAssembly().GetName().GetPublicKeyToken();
Unfortunatelly I might need to change the dll during run time, so I cannot have it loaded.
Is there any way of getting that information without having to load the dll? Even by giving the actual path of the dll?
Side note: I can also get that information by using System.Diagnostics to start a process to use the utility SN to get that information, but I would like to avoid that.
Upvotes: 4
Views: 1140
Reputation: 886
It is possible to get the public token without loading the asssembly by doing:
AssemblyName.GetAssemblyName("assembly-path.dll").GetPublicKeyToken();
Upvotes: 4