• 【转帖】Visual Studio Tip: Get Public Key Token for a Strong Named Assembly


    原帖位置http://blogs.msdn.com/b/miah/archive/2008/02/19/visual-studio-tip-get-public-key-token-for-a-stong-named-assembly.aspx

    I can't remember where I picked this tip up from, but I have found it useful on many occasions so I thought that I would share it.

    Sometimes I need to reference the strong named assembly that I am writing in a config file or some other location, and I need to put in the fully qualified name such as:

    MyNamespace.MyAssembly, version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

    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'.

    External Tools Dialog 

    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.

    VS Tools Menu 

    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.

    Output Window 

  • 相关阅读:
    windows域相关
    IDEA 找不到maven编译命令操作
    Idea Cannot import to svn: Cannot run program "svn"
    NodeJS在CentOs7下安装
    NodeJS 安装不存在的模块
    NodeJS淘宝 CNPM 镜像
    Intellij Idea 使用入门教程
    Java中基本类型占用字节数
    JWT—JSON Web Token
    2016年度最受欢迎中国开源软件
  • 原文地址:https://www.cnblogs.com/yangqianming/p/2083544.html
Copyright © 2020-2023  润新知