Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get public key tokent without loading dll

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.

like image 499
lulas Avatar asked Sep 16 '25 08:09

lulas


1 Answers

It is possible to get the public token without loading the asssembly by doing:

AssemblyName.GetAssemblyName("assembly-path.dll").GetPublicKeyToken();
like image 134
lulas Avatar answered Sep 19 '25 12:09

lulas