Situation
You need the public key token of an assembly reference. E.g. to set the InternalsVisibleTo() attribute for a Unit-Test.
Problem
There is no standard mechanism embedded in Visual Studio (2010).
Solution
Create a “external tool” entry that calls sn.exe and redirects the output to the output window.
Dialog: [Tools] – [External tools…] – [Add]
Title: As you wish (e.g. “Get &PublicKeyToken).
Command: C:Program FilesMicrosoft SDKsWindowsv6.0ABinsn.exe
Arguments: -Tp $(TargetPath)
Use Output window: Check
Sources
Leave a Reply