C # advanced programming-strong naming of shared programming Sets

Source: Internet
Author: User

First, let's take a look.ProgramSET command: command line InputIldasmThis is an disassembly program. In addition,. Net reflector is also a powerful tool for analyzing assembly, which canCode
Decompiled into C #, C ++, and VB. Http://www.aisto.com/roeder/dotnet.

To put it bluntly, the shared Assembly requires a strong name. Use sn.exe to generate a key pair. Procedure:

    1. Create a class library. The namespace is sharing, which is consistent with the process of creating a common class library.
    2. Create a strong name: generate a public key and private key pair, and strictly protect the private key.
      ① You can select project Properties> signing> sign the assembly, and then select or add the pfx file.
      ② Use the command line tool:
      Generation:Sn-KE: \ study \ assemblyshared \ sharing \ test1.keys note that the following path should specify the complete path of the file. At the beginning, it was always fail, which was caused by a problem in writing this path.
    3. View the public key:Sn-PE: \ study \ assemblyshared \ sharing \ test1.keys E: \ study \ assemblyshared \ sharing \ test1.key
    4. Then useSn-TPCommand to view the Public Key

5. Install the shared assembly and run the gacutil/I command. At the beginning, the system prompts you to use the Administrator account to perform the operation. Later, the operation is successful.

6. Create a project and use the shared assembly. Make sure to set the referenced property localcopy to false.
7. Main commands used for strong naming:
Generation: Sn-K Keyfile. SNK public key and private key pair

Public extraction key: Sn-P Keyfile. SNK public. SNK extract the public key from Keyfile and save it to the public. SNK file to sign the Assembly later.

Skip verification: Sn-VR Assembly performs skip verification on the Assembly on the development machine. The Assembly is not signed.

Signature: Sn-r Assembly Keyfile. SNK late signature of assembly, this step is done before release

Cancel skip verification: Sn-vu Assembly cancels skip verification on the Assembly on the development machine. The Assembly is signed at this time.

Or cancel all: Sn-VX cancel all verification

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.