Visual Studio Tip: Get Public Key Token for a Strong Named Assembly
2014-08-16 11:05
351 查看
The first 3 parts are easy to get. I should know the name, version, and culture for the assembly since I am writing it. The part that can be a little harder to locate is the Public Key Token for my signed assembly. One common way to do this is to use Reflector to open my assembly and get the token (actually, Reflector will give you the entire fully qualified name as in the example above). For me, that is just too much work. If I have the project in Visual Studio already, I would much rather just click a menu item in Visual Studio to get the result. Here is how that can be set up:
In Visual Studio, go to the Tools menu and click the External Tools menu item. This will bring up the External Tools dialog. The image below shows the information that I have added to add a new menu item called 'Get SN Token'.
![](http://blogs.msdn.com/photos/jeremiahclark/images/7804139/original.aspx)
The command is the path to sn.exe which can be in different places depending on your VS version. The easiest way to find it is to open a VS Command Prompt and type "where sn.exe". The arguments field is set to -T and then the $(TargetPath) variable. The "Use Output Window" option is checked so that the results will be shown in the VS output window. After clicking OK, this will be enabled as a menu item as shown below.
![](http://blogs.msdn.com/photos/jeremiahclark/images/7804193/original.aspx)
The output for this command will be displayed in the output window. This also works if you have multiple projects in the same solution. Just highlight the project in Solution Explorer and then click the menu item.
In Visual Studio, go to the Tools menu and click the External Tools menu item. This will bring up the External Tools dialog. The image below shows the information that I have added to add a new menu item called 'Get SN Token'.
The command is the path to sn.exe which can be in different places depending on your VS version. The easiest way to find it is to open a VS Command Prompt and type "where sn.exe". The arguments field is set to -T and then the $(TargetPath) variable. The "Use Output Window" option is checked so that the results will be shown in the VS output window. After clicking OK, this will be enabled as a menu item as shown below.
The output for this command will be displayed in the output window. This also works if you have multiple projects in the same solution. Just highlight the project in Solution Explorer and then click the menu item.
相关文章推荐
- 【转帖】Visual Studio Tip: Get Public Key Token for a Strong Named Assembly
- Get public key or public token for strong named assembly
- How to find public key token for a .NET DLL or assembly
- 利用Visual Studio 2010 External Tools获取Assembly的公钥标记(Public Key Token)
- apt-get出现no public key available for the following key IDs
- yum 安装报 关于Public key for *.rpm is not installed 的解
- Java tip: How to get CPU, system, and user time for benchmarking
- Source not found for Scanner.getNextToken() line: 1010
- yum 安装报 关于Public key for *.rpm is not installed 的解决方法
- PYQT TIP : QSpinBox signal waits for return key to be pressed
- public key for elfutils-libelf-devel is not install_YUM设置问题
- apt出现no public key available for the following key IDs
- [ZT]Three ways to tell if a .NET Assembly is Strongly Named (or has Strong Name)
- how to sign an assembly with a strong name & how to create a pair key怎样通过强名给程序集签名以及如何创建钥匙对?
- Red Hat Linux使用yum 安装报 关于Public key for *.rpm is not installed 的解决方法
- Public key for httpd-2.2.3-63.el5.centos.1.i386.rpm is not installed
- Method and system for public-key-based secure authentication to distributed legacy applications
- Public key for kernel-headers-2.6.18-194.32.1.e...
- How to fix no public key available for the following key IDs in debian
- Ubuntu下apt-get出现“no public key available…”解决方法