How to reference assemblies in the GAC

Source: Internet
Author: User

From: http://www.eggheadcafe.com/PrintSearchContent.asp? Linkid = 1175

 

We have been getting some posts lately where developers are installing assemblies in the GAC and then asking why they don't see them enumerated in the Add reference dialogs. this shoshould clear things up for most developers.

If you install assemblies in the GAC and then wonder why you don't see them enumerated in the Add reference dialogs, or, if you are complaining that if you browse the Assembly folder in the Windows directory, you can't see the Assembly in order to add a reference to it, read on.

The add reference dialog box is path-based and does not enumerate the components from the GAC. the Assembly folder under Windows is a special folder view and so you cannot browse to an assembly from this folder and keep CT to be able to add a reference to it in the normal way.

If you want to use an assembly from the GAC, you should drop your assemblies into a local folder, and then add a reference to the Assembly from this folder. you may want to set the "Copy local" property to false for that Assembly if you do not want the assembly to be copied locally to your project folders. at runtime, the application will automatically use the Assembly from the GAC.

How to make your custom assemblies appear in the Add reference dialog:

To display your assembly in the Add reference dialog box, you can add a registry key, such as the following, which points to the location of the Assembly
[HKEY_CURRENT_USER \ Software \ Microsoft \. netframework \ assemblyfolders \ myassemblies] @ = "C: \ myassemblies"
-- Where "myassemblies" is the name of the folder in which the Assemblies reside.

Note: You can create the this registry entry under the HKEY_LOCAL_MACHINE hive. this will change the setting for all of the users on the system. if you create this registry entry under HKEY_CURRENT_USER, this entry will affect the setting for only the current user.

For more information about assemblies and the GAC, vist the following msdn web page:

Http://msdn.microsoft.com/library/en-us/cpguide/html/cpconglobalassemblycache.asp

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.