简体   繁体   English

如何在Visual Studio C#2010 Express Edition中创建DLL文件?

[英]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\\Debugbin\\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\\Debugbin\\Release文件夹,你会找到DLL。

在此输入图像描述

  1. Create a new class library project 创建一个新的类库项目
  2. Create classes and code 创建类和代码
  3. compile Project 编译项目
  4. Dll Created Dll创建
  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? 为什么要首先避免构建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.

相关问题 Visual Studio C#2010快递版中的对象浏览器在哪里? - Where is the object browser in visual studio C# 2010 express edition? 在Visual Studio Express Edition C#中确定.dll依赖项 - Determining .dll dependencies in Visual Studio Express Edition C# 如何将必需的DLL与Visual C#中的解决方案捆绑在一起(Express,2010年) - How to bundle a required DLL with a solution in Visual C# (Express, 2010) 部署在Visual Studio 2010 Express Edition中制作的C#应用​​程序 - Deploy my C# application made in Visual Studio 2010 Express Edition 在Visual Studio 2010 C#项目中将.chm文件链接到.dll - Linking a .chm file to a .dll in Visual Studio 2010 C# Project 如何在Visual Studio C#2008 Express Edition中将C#文件与数据库一起发送到一个zip文件中? - How do I send a C# file in Visual Studio C# 2008 express edition along with the database in one zip file? Visual Studio 2010 Express C#限制 - Visual Studio 2010 Express C# limitations 在Visual Studio 2010 Express中自动从dll生成C#包装类? - Automatically generate C# wrapper class from dll in Visual Studio 2010 Express? Visual Studio Express 2013-创建单独的C#代码文件? - Visual Studio Express 2013 - Create separate c# code file? Visual C#Express 2010从Visual Studio导入项目 - Visual C# Express 2010 Importing a project from Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM