Adding Assemblies to the Visual Studio "Add Reference" Dialog(收集)

本文介绍如何将自定义的.NET程序集手动添加到Visual Studio中,以便在项目中使用。包括编辑注册表来指定程序集路径,以及如何处理同一程序集不同版本的问题。

When you attempt to add an assembly reference to a Visual Studio project, the Add Reference dialog appears with a list of registered global assemblies in the .NET tab:

Add Your Assembly to Visual Studio

Unfortunately, adding your assembly to the Global Assembly Cache (GAC) does NOT make it automatically appear in the Visual Studio list of installed assemblies; you must add your assembly manually as follows:

Run regedit to edit the Windows Registry.

  1. Navigate to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders key.
  2. Right click on the AssemblyFolders key, then select New > Key. Enter the name of your assembly (without the .dll extension).
  3. Double click on the key's (Default) value. The Edit String dialog will appear. Enter the full path of the folder where your assembly resides. Note that all assemblies in that folder will appear in the Visual Studio list.
  4. IMPORTANT! You must exit and restart Visual Studio to see your assembly in the Add Reference dialog.

Multiple Versions of Same Assembly

Note that if you add multiple versions of the same assembly to the GAC, and you want all versions to appear in the Visual Studio list of installed assemblies, you have two options:

  1. Provide a different name for each version of the assembly, such as MyLib1.0.dll and MyLib2.0.dll, or
  2. Store each version of the assembly in its own folder, and add each folder to the registry as shown above.

转载于:https://www.cnblogs.com/wuhenke/archive/2011/01/15/1936497.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值