In response to a question on my article How to install a DLL to the GAC on Windows Server 2012 using only PowerShell (without having to install SDK or Visual Studio) here’s how you can find the PublicKeyToken for a DLL using only PowerShell.
([system.reflection.assembly]::loadfile("c:\temp\MyDLL.dll")).FullName
The output of this PowerShell statement will provide the Version, Culture and PublicKeyToken as shown below.
MyDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=630d986a50055aa6
I fell into the trap of thinking that this command tests which version of a DLL is in the GAC. It does NOT, unless you happen to pick the dll in the Windows\assembly folder
LikeLiked by 1 person
Thanks for highlighting that Steve, hopefully it clarifies the usage of this command for others.
LikeLiked by 1 person
Any idea on how to get the version and token details of DLLs already present on the server, without specifying a particular path of DLL??
LikeLiked by 1 person
What details do you have to identify the DLL or are you looking for a dump of all DLLs? There are usually quite a few DLL’s in the GAC and you also have separate 32 and 64 bit areas of the GAC.
LikeLike