C#如何将我的dll添加到.Net Framework组件列表

C# How to add my dll to .Net Framework Component List
2021-06-20
  •  译文(汉语)
  •  原文(英语)

C#如何将我的dll添加到.Net Framework组件列表

我想将我的dll添加到具有dll的组件列表中,如镜像所示如何通过C#代码做到

速聊1:
转到"浏览"选项卡并搜索您的DLL
速聊2:
我知道这一点,但我想知道如何将dll添加到此列表中
速聊3:
如何通过c#代码执行此操作
速聊4:
要使用C#代码添加(请参见stackoverflow.com/questions/18569367/…)
速聊5:
-GAC与该标签无关.
解决过程1

.NET选项卡的内容由注册表设置确定.您可以轻松更改它们:

  • 启动Regedit.exe
  • 导航到HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Microsoft.NETFramework \ AssemblyFolders项(将Wow6432Node拖放到32位计算机上)
  • 用鼠标右键单击AssemblyFolders键,新建+键
  • 键入一个独特的名称,例如产品或您自己的名称.实际的字符串无关紧要
  • 双击右窗格中的(默认)值,然后将名称键入包含程序集的目录
  • 重新启动Visual Studio

将添加该文件夹的示例.reg文件,对其进行编辑以供您自己使用:

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\AssemblyFolders\Hans Passant]
@="C:\\Users\\hpass_000\\Projects\\ClassLibrary1\\bin\\Release"
速聊1:
使用RegistryKey类.这不是一个好主意,除非您的程序运行提升且无法确保VS重新启动,否则您无法写入该注册表项.
速聊2:
那岂不是工作,始终ommit的WoW6432Node /从部分章关键?系统文件夹重定向应该自动启动并重定向到64位上的WoW版本?编辑:好的,应该先阅读该帖子;)这是关于手动编辑的...没关系!
解决过程2

右键单击工具栏,选择"项目",然后通过浏览按钮添加您的dll.

速聊1:
我知道这一点,但我想知道如何将dll添加到此列表中
速聊2:
尝试将其添加到GAC
解决过程3

很简单.

  1. 签署您的dll.
  2. 将您的dll放在您的framework文件夹中.

样本:

将您的dll复制到此文件夹

   C:\Windows\Microsoft.NET\Framework\v2.0.50727

是否将打开引用Dll的Proyect都无关紧要.尝试添加参考,您将看到您的dll.

希望对您有所帮助.

C# How to add my dll to .Net Framework Component List

I want add my dll to component list with dlls as shown in image How to do this by C# code

Talk1:
Go to the "browse" tab and search for your DLL
Talk2:
i know this, but i want to know how to add dll to this list
Talk3:
how to do this By c# code
Talk4:
TO add using c# code (see stackoverflow.com/questions/18569367/…)
Talk5:
- GAC has nothing to do with this tab.
Solutions1

The content of the .NET tab is determined by registry settings. You can easily change them:

  • Start Regedit.exe
  • Navigate to the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\AssemblyFolders key (drop Wow6432Node on a 32-bit machine)
  • Right-click the AssemblyFolders key, New + Key
  • Type a distinctive name, like the product or your own name. The actual string doesn't matter
  • Double-click the (Default) value in the right pane and type name to the directory that contains your assemblies
  • Restart Visual Studio

A sample .reg file that will add the folder, edit it for your own use:

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\AssemblyFolders\Hans Passant]
@="C:\\Users\\hpass_000\\Projects\\ClassLibrary1\\bin\\Release"
Talk1:
Use the RegistryKey class. This is not a great idea, you cannot write to that registry key unless your program runs elevated and you can't make sure that VS is restarted.
Talk2:
Wouldn't it work to always ommit the WoW6432Node/ part from the reg key? System folder redirection should kick in automatically and redirect to the WoW version on 64bit? Edit: ok, should read the post first ;) This is about manual edits... nevermind!
Solutions2

Right click on toolbar, select choose Items and add your dll through browse button

Talk1:
i know this, but i want to know how to add dll to this list
Talk2:
Try adding that to GAC
Solutions3

It is simple.

  1. Sign your dll.
  2. Put your dll inside your framework folder.

Sample:

Copy your dll to this folder

   C:\Windows\Microsoft.NET\Framework\v2.0.50727

Not matter if the Proyect that will Reference Dll is open. Try to add Reference and you will see your dll.

Hope this help.

转载于:https://stackoverflow.com/questions/18571650/c-sharp-how-to-add-my-dll-to-net-framework-component-list

本人是.net程序员,因为英语不行,使用工具翻译,希望对有需要的人有所帮助
如果本文质量不好,还请谅解,毕竟这些操作还是比较费时的,英语较好的可以看原文

留言回复
我们只提供高质量资源,素材,源码,坚持 下了就能用 原则,让客户花了钱觉得值
上班时间 : 周一至周五9:00-17:30 期待您的加入