如何在VS2010中使用C#从我的项目中创建DLL [英] How can I create a DLL from my project in C# in VS2010

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

问题描述

我想从C#VS 2010中的项目中创建一个DLL
我该怎么办?
请尽快帮助我

请帮助我!

I want to create a DLL from my project in C# VS 2010
How can I do that?
please help me soon

Please help me!

推荐答案

要么创建一个类库项目,要么仅引用另一个项目中的exe文件.您可以从exe使用所有公共内容,就像从DLL中使用它们一样.

干杯!
Either create a class library project or just reference the exe file from another project. You can use all the public stuff from an exe just as you would have used them from a DLL.

Cheers!


项目具有选项输出类型"(在Visual Studio中,这是属性应用程序"的第一个选项卡).类型为"Windows应用程序",控制台应用程序"和类库". DLL是类库".您可以随时更改输出类型.

请注意,类型之间的区别不是很重要.原则上,任何应用程序都可以扮演该库的角色:可以将其添加为对任何其他.NET项目的引用.一个库可以由其他程序集通过其主模块(DLL文件)使用添加引用" =>来引用. 浏览"或给定的字符串名称(带符号),添加到GAC中并由其名称引用.在Visual Studio中,设置项目依赖项很重要.最方便的方法是通过添加引用" =>从相同的解决方案引用项目. 项目"标签.在这种情况下,将自动设置项目依赖项.此外,您可以随时更改引用程序集的签名和/或版本(对于以其DLL文件名引用的程序集,应删除并重新添加引用).

最后,可以使用System.Reflection.Assembly动态加载程序集.

-SA
A project has the option "Output type" (in Visual Studio, this is in the first tab of the properties, "Application"). The types are "Windows Application", "Console Application" and "Class Library". DLL is a "Class Library". You can change output type any time.

Note that the difference between type is not very essential. In principle, any application can play a role of the library: it can be added as a reference to any other .NET project. A library can be referenced by other Assembly by its main module (DLL file) using "Add Reference" => "Browse" or given a string name (signed), added to GAC and referenced by its name. In Visual Studio, it is important to setup project dependencies. The most convenient way is to reference a project from the same solution through "Add Reference" => "Projects" tab. In this case, project dependencies are set up automatically. Besides, you can change signature and/or version of referenced assembly at any time (for assembly referenced by its DLL file name a references should be removed and re-added).

Finally, assembly can be loaded dynamically using System.Reflection.Assembly.

—SA


MSDN链接此处 [ ^ ](创建一个使用命令行Dll.)
MSDN link here[^] (creating a Dll using the command line).


这篇关于如何在VS2010中使用C#从我的项目中创建DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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