在C#中创建.dll以访问我的任何项目 [英] Create .dll in C# to access into my any project

查看:72
本文介绍了在C#中创建.dll以访问我的任何项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





如何在C#中创建GAC .dll?我想在不使用System命名空间在我的项目中添加引用的情况下访问该.dll。



谢谢。

解决方案

否..除非你添加它的引用,否则无法访问dll。您可以创建一个DLL并安装在GAC中,但仍然需要添加引用。



另外要纠正的是对System.dll的引用默认情况下添加到Visual Studio项目...尝试创建一个VS项目并检查默认添加的dll引用


你不能 - 你必须添加一个引用你申请引用的DLL, 包括 系统的。在VS中创建项目时,会为您添加这些项目 - 在解决方案资源管理器窗格中的项目中的参考下查看。



您可以添加对此列表的引用创建新项目时: http://stackoverflow.com / questions / 9272239 / how-to-add-custom-libraries-to-default-solution-template [ ^ ]并通过编辑现有项目模板,通过defualt添加相应的using语句:将项目添加到Visual Studio默认文件 [ ^ ]

您好,



使用 Gacutil.exe [ ^ ]

 gacutil / i dllpath.dll 



维基百科页面,您将找到驻留在GAC中的程序集的要求:



要求





驻留在GAC中的大会必须遵循特定的版本控制方案,允许并行执行不同的代码版本。具体来说,必须强烈命名此类程序集。



但是,正如其他人指出的那样,您仍然需要添加对程序集的引用。


Hi,

how can create GAC .dll in C#?.I want to access that .dll without adding reference in my project.like using System namespace.

Thanks.

解决方案

No.. A dll cannot be accessed unless you add its reference. You can create a dll and install in GAC , but still you will have to add the reference.

And the other thing to correct is that the reference to System.dll is added to the Visual Studio project by default... Try creating a VS project and check the dll references added by default


You can''t - you have to add a reference to an DLL you application references, including System ones. When you create a project in VS, these are added for you - look under References in your Project in the Solution Explorer pane.

You can add a reference to this list when you create a new project: http://stackoverflow.com/questions/9272239/how-to-add-custom-libraries-to-default-solution-template[^] and add the appropriate using statements by defualt by editing the existing project templates: Adding your items to Visual Studio default files[^]


Hi,

Use Gacutil.exe[^]

gacutil /i dllpath.dll


At the Wikipedia page, you''ll find the requirements for assemblies residing in the GAC:


Requirements



Assemblies residing in the GAC must adhere to a specific versioning scheme which allows for side-by-side execution of different code versions. Specifically, such assemblies must be strongly named.


But, as the others pointed out, you still have to add a reference to your assembly.


这篇关于在C#中创建.dll以访问我的任何项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆