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.