如何在 Visual Studio 中安装 C# 类库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18586243/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I install a C# class library in Visual Studio?
提问by 1934286
I am trying to use a class library which I found on a different question here.
I am quite new to C#, Visual Studio, and OOP in general, so please excuse me if this is not the right question.
总的来说,我对 C#、Visual Studio 和 OOP 很陌生,所以如果这不是正确的问题,请原谅。
I followed the link and downloaded the zip. The help file does not seem to contain any directions on how to get Visual Studio to utilize the library. I figure that I have to tell it to use the library somehow, but I really don't know what to do. Or maybe I need to copy the .dll to a specific folder. I also assume I need using ...
in the top of the .cs files that use it.
我按照链接下载了zip。帮助文件似乎没有包含有关如何让 Visual Studio 使用该库的任何说明。我想我必须告诉它以某种方式使用库,但我真的不知道该怎么做。或者我可能需要将 .dll 复制到特定文件夹。我还假设我需要using ...
在使用它的 .cs 文件的顶部。
How can I use this library in a Visual Studio C# project?
如何在 Visual Studio C# 项目中使用此库?
采纳答案by now he who must not be named.
You should add a reference.
你应该添加一个引用。
In the project you are working on, you can add a reference to the dll (or a library) by doing navigating to:
在您正在处理的项目中,您可以通过导航到以下位置来添加对 dll(或库)的引用:
(Project)->References->Add Reference
(项目)->引用->添加引用
[You will find Properties, References and [class]files below your project]
[您将在项目下方找到属性、引用和 [类] 文件]
According to your question, you should add "UltraID3Lib.dll" to your project references and use it through adding a using
on top of your project files like this:
根据您的问题,您应该将“UltraID3Lib.dll”添加到您的项目引用中,并通过using
在您的项目文件上添加一个来使用它,如下所示:
using HundredMilesSoftware.UltraID3Lib;
After you have successfully added the resource you should build the project and it will copy all the necessary files to your output directory (bin/Release or bin/Debug).
成功添加资源后,您应该构建项目,它会将所有必需的文件复制到您的输出目录(bin/Release 或 bin/Debug)。
回答by oshan2csd
Step 1:
第1步:
Open Debug Folder (you can find it In your project Folder => Bin => Debug). Copy .dll >files there.
打开调试文件夹(您可以在您的项目文件夹中找到它 => Bin => 调试)。在那里复制 .dll > 文件。
Step2:
第2步:
In Solution Explorer Right Click on References => Add References Go to Project Tab. Under the Project Tab you can find Added References (References added In Debug Folder). >Simply select needed references & hit OK. You're done
在解决方案资源管理器中右键单击引用 => 添加引用转到项目选项卡。在项目选项卡下,您可以找到添加的引用(在调试文件夹中添加的引用)。>只需选择所需的参考并点击确定。你完成了
Happy Coding....! :D
快乐编码......!:D