为什么手动复制的程序集未在“添加引用”对话框中列出?
我已使用 gacutil 命令将 log4net 程序集复制到 GAC。从资源管理器中,我可以看到它已被复制,但是当我尝试将其引用添加到项目时,我无法在添加引用对话框中看到它。
还有另一种方法可以从硬编码路径引用它,但如果其他开发人员的计算机上不存在该路径,则可能会给其他开发人员带来问题。
我该如何解决这个问题?
Possible Duplicate:
Assembly installed into the GAC not showing up in Visual Studio
I have copied log4net assembly to GAC using gacutil command. From explorer I am able to see it that it is copied but when I tried to add its reference to a project I am not able to see it in add reference dialog box.
There is another way to refer it from hard coded path but that could create problem to another developer if that path is not exist on his machine.
How can I resolve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
添加到 GAC 的程序集通常不会在“添加引用”对话框中列出。您必须添加
指向程序集位置的注册表键。例如:
其中
MyAssemblies
是程序集所在文件夹的名称。有关详细信息,请参阅此知识库文章。
另请注意,通常不鼓励您在 GAC 中安装程序集。若要直接从 Visual Studio 中的项目引用程序集,您应该将该程序集添加到项目文件夹中,并添加对此 DLL 本地副本的引用。
Assemblies added to the GAC are not normally listed in the Add Reference dialog. You will have to add
a key to the Registry that points to the location of the assembly. For example:
where
MyAssemblies
is the name of the folder in which the assembly resides.See this knowledge base article for more details.
Do also note that you are generally discouraged from installing assemblies in the GAC. To directly reference an assembly from a project in Visual Studio, you should add the assembly to your project folder and add a reference to this local copy of the DLL instead.
例如,在项目中添加一个名为引用的文件夹,然后将 dll 添加到该文件夹,并从该文件夹添加对该 dll 的引用。
Add a folder in your project called references for example, and add the dll to this folder and add reference to the dll from this folder.
来自 MSDN
From MSDN