When we try to retrieve Assembly Public Key token information using SN.exe tool, we might receive an error like "Failed to convert key to token -- The public key for assembly '(null)' was invalid". The tip shows resolution to the error.
Reproduce Error:
Open Visual studio command prompt and run below command
sn.exe -t "D:\Project\Custom.dll"
Press enter key, it throws below error (Failed to convert key to token -- The public key for assembly '(null)' was invalid).
Resolution:
sn.exe arguments are case sensitive(observe above command: t was in small case). so pass below command to get Public key token information
sn.exe -T "D:\Project\Custom.dll"
Output:
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Public key token is 862052368f18d74f