To deploy a DLL to the global assembly cache (GAC)

Source: Internet
Author: User
For some class library projects or user control projects (generally, this type of project is eventually compiled with one or more DLL files, and when the program is developed, it is sometimes necessary to deploy the developed assembly (DLL file) installation to the GAC (the global assembly cache) so that other programs can call it.
In general, there are several ways to install an assembly (DLL) into the GAC:
1. Management Tools->microsoft.net Framework 2.0 configuration-> Management-> My Computer-> assembly cache-> Select the right key "add"-> add the assembly to the assembly cache. (Not found, my sun.) ~ ~)
2. Manually drag the DLL file that will install the deployment to the assembly folder under Windows in the System directory (typically c:/windows/assembly), which is not easy to use when installing the deployment.
3. Install using the Gacutil.exe tool: Gacutil-i "full path to the DLL file to be registered."

The "Gacutil.exe" tool is. NET Self tool (C:\Program Files\Microsoft Sdks\windows\v7.0a\bin)
Enter "cmd" into the command window at the start of the operation, and select the directory to the "Gacutil.exe" file from the CD.

or use the Visual Studio command prompt

As entered at the command line: Gacutil-i D:/microsoft.sharepoint.dll

You can enter ' gacutil-? ' View Help


However, note: You cannot install a weak named assembly into the GAC. We must ensure that the project has a strong name before we can do the above 2-3 methods of installation.
    To add a strengthening name to a project requires three steps:
1. After the project is debugged, use the Sn.exe tool to generate a key. Sn-k "Full path of the generated key".
    as entered at the command line: Sn-k d:/mykey.snk
2. Associate the key with the project's assembly: Project Properties--> Signature--> Select a strong name key file for the assembly signing-->.
    In addition, there is another way to modify the properties of "AssemblyKeyFile" in the project's AssemblyInfo.cs file.
    such as: [Assembly:assemblykeyfile ("D://mykey.snk")]
3. Rebuild the project set.

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.