[英]How to Create a DLL file in Visual Studio C# 2010 Express edition?
I have already come across the Stack Overflow question " Is there a way to generate a DLL file from Visual Studio Express without explicitly creating a DLL project? ", but it does not directly answer my query, so I'm raising it here. 我已经遇到过Stack Overflow问题“ 有没有办法从Visual Studio Express生成DLL文件而没有显式创建DLL项目? ”,但它没有直接回答我的查询,所以我在这里提出它。
The problem I am facing while trying to make the DLL is that I can't find any option under Build named build class file. 我在尝试制作DLL时遇到的问题是我在Build命名构建类文件下找不到任何选项。 I have changed the project property to class file (shown below)
我已将项目属性更改为类文件(如下所示)
This is how it is: 这是这样的:
And here is how my build option is getting displayed: 以下是我的构建选项的显示方式:
Also when I am using the command-line option the dll file is getting generated but it is not getting the properties I'm setting in the application. 此外,当我使用命令行选项时,dll文件正在生成,但它没有获取我在应用程序中设置的属性。
I am new with Visual Studio so a litte bit confused about this part. 我是Visual Studio的新手,因此对此部分感到困惑。
The "Build Solution" option in your second screenshot is the thing you need to click to produce your dll, alternatively you can right click on your project in the Solution Explorer and click "Build": 第二个屏幕截图中的“构建解决方案”选项是您需要单击以生成您的dll的选项,或者您可以在解决方案资源管理器中右键单击您的项目,然后单击“构建”:
(If you only have one project in your solution then these two will both do exactly the same thing) (如果你的解决方案中只有一个项目,那么这两个项目将完全相同)
The output dll will normally be placed in the bin\\Debug
or bin\\Release
directory depending on whether you are in Release or Debug configuration, check the "Build" tab of the project properties for the exact path. 输出dll通常会放在
bin\\Debug
或bin\\Release
目录中,具体取决于您是处于Release还是Debug配置,请检查项目属性的“Build”选项卡以获取确切的路径。
The reason why you aren't seeing a "Build class file" option is because this is what the "Build project" menu item does - it will produce a class library if the project output type is "Class Library", a windows executable if the project output type is "Windows Application" etc... 您没有看到“构建类文件”选项的原因是因为这是“构建项目”菜单项的作用 - 如果项目输出类型是“类库”,它将生成一个类库,如果是项目输出类型是“Windows应用程序”等...
You're not trying to build a class file - you're trying to build a class library . 您不是要尝试构建类文件 - 您正在尝试构建类库 。
And you just build the solution - that will build each of the projects in your solution, including your LicenseCheckLibrary
project is just a class library project. 您只需构建解决方案 - 即构建解决方案中的每个项目 ,包括您的
LicenseCheckLibrary
项目只是一个类库项目。
It looks like you're basically there - look in the bin\\Debug
or bin\\Release
folders under LicenseCheckLibrary, and you'll find the DLL. 看起来你基本上就在那里 - 查看LicenseCheckLibrary下的
bin\\Debug
或bin\\Release
文件夹,你会找到DLL。
Remember you will prob have to include the namespace. 请记住,您将不得不包含命名空间。 in the new project.
在新项目中。
Why would you want to avoid building a DLL file in the first place? 为什么要首先避免构建DLL文件? Are you developing an EXE file in order to test the logic and then conver it to DLL once it is working fine?
您是否正在开发一个EXE文件以测试逻辑,然后一旦它正常工作就将其转换为DLL? If yes, why not create two projects: Windows Console and Class Library.
如果是,为什么不创建两个项目:Windows控制台和类库。 Inside Class Library implement the licensing logic and use Windows COnsole to test the logic.
Inside Class Library实现许可逻辑并使用Windows COnsole来测试逻辑。 When you say you are new with Visual Studio, what exactly do you mean?
当你说你是Visual Studio的新手时,你的意思是什么? You never used it before or you are new to .NET Framework programming?
您以前从未使用过它或者您是.NET Framework编程的新手吗? .NET Framework has certain classes for developing licenses.
.NET Framework具有用于开发许可证的某些类。 Also, there were quetions here on stackoverflow regarding the licensing.
此外,stackoverflow上有关于许可的问题。 Find some of them instead of reinventing the wheel.
找到其中一些而不是重新发明轮子。
Have a look at this article http://www.developer.com/net/net/article.php/3074001 看看这篇文章http://www.developer.com/net/net/article.php/3074001
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.