简体   繁体   中英

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.

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. 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.

I am new with Visual Studio so a litte bit confused about this part.

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":

解决方案资源管理器中上下文菜单的屏幕截图

(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.

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...

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.

It looks like you're basically there - look in the bin\\Debug or bin\\Release folders under LicenseCheckLibrary, and you'll find the DLL.

在此输入图像描述

  1. Create a new class library project
  2. Create classes and code
  3. compile Project
  4. Dll Created
  5. Create a new project
  6. Click on Add Reference
  7. Navigate to the class library folder
  8. Go into the debug folder or whatever and include

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? Are you developing an EXE file in order to test the logic and then conver it to DLL once it is working fine? If yes, why not create two projects: Windows Console and Class Library. Inside Class Library implement the licensing logic and use Windows COnsole to test the logic. When you say you are new with Visual Studio, what exactly do you mean? You never used it before or you are new to .NET Framework programming? .NET Framework has certain classes for developing licenses. Also, there were quetions here on stackoverflow regarding the licensing. Find some of them instead of reinventing the wheel.

Have a look at this article http://www.developer.com/net/net/article.php/3074001

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM