向 VB.NET 项目添加 DLL 引用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11674944/
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
Adding DLL reference to VB.NET project
提问by user1555362
Just to start off, this question does seem very similar to another post Add the DLL (lame_enc.dll) reference to my project, but I haven't been able to successfully apply that answer. I am pretty new to VB.NET so it is very possible I'm simply missing something obvious.
刚开始,这个问题似乎与另一篇文章Add the DLL (lame_enc.dll) reference to my project非常相似,但我无法成功应用该答案。我对 VB.NET 还很陌生,所以很可能我只是遗漏了一些明显的东西。
I am trying to link a DLL to a VB.NET 2010 project to allow my VB app to play *.ogg files. I followed some other advice here on the forums and downloaded FMOD'sFMOD Ex Programmers API. I am trying to now reference that functionality. These appear to be the files I need to somehow reference.
我正在尝试将 DLL 链接到 VB.NET 2010 项目,以允许我的 VB 应用程序播放 *.ogg 文件。我在论坛上遵循了其他一些建议,并下载了FMOD 的FMOD Ex Programmers API。我现在正在尝试引用该功能。这些似乎是我需要以某种方式引用的文件。
C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\fmodex64.dll.
C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\libfmodex64_vc.lib.
C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\fmodex64.dll。
C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\libfmodex64_vc.lib。
I haven't discovered how to add a *.lib reference (or the equivalent), but selecting the DLL as a reference gives the following error.
我还没有发现如何添加 *.lib 引用(或等效引用),但是选择 DLL 作为引用会出现以下错误。
A reference to 'C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\fmodex64.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.
无法添加对“C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\fmodex64.dll”的引用。请确保该文件可访问,并且它是有效的程序集或 COM 组件。
I'm not sure what I could be missing. Any ideas? Thanks!
我不确定我可能会错过什么。有任何想法吗?谢谢!
回答by user2516305
In Solution Explorer, double-click the My Project node for the project.
在解决方案资源管理器中,双击项目的“我的项目”节点。
In the Project Designer, click the References tab.
在项目设计器中,单击引用选项卡。
Click the Add button to open the Add Reference dialog box.
单击添加按钮打开添加引用对话框。
In the Add Reference dialog box, select the tab indicating the type of component you want to reference.
在“添加引用”对话框中,选择指示要引用的组件类型的选项卡。
Select the components you want to reference, then click OK.
选择要引用的组件,然后单击“确定”。
回答by user1555362
Another approach I was trying is working for me. I found a site with a working example of a LibZPlay VB.NET sample ( http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=7789&lngWId=10). It runs under VS 2008 and I was able to adapt my project to use LibZPlay (open source library http://libzplay.sourceforge.net/WELCOME.html) under VS 2008.
我正在尝试的另一种方法对我有用。我找到了一个站点,其中包含一个 LibZPlay VB.NET 示例的工作示例(http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=7789&lngWId=10)。它在 VS 2008 下运行,我能够调整我的项目以在 VS 2008 下使用 LibZPlay(开源库http://libzplay.sourceforge.net/WELCOME.html)。
That is sufficient for me for now. Thanks for your advice. It was likely some configuration issue or misunderstanding on my end.
这对我来说已经足够了。谢谢你的建议。这可能是我的一些配置问题或误解。
回答by Bob Brandt
Using VB.net 2015 I (could not add or even find a System32 dll) as a reference using Solution Explorer, Tab References. Going to the MAIN Menu, Projects/Add References... Used Browse and All the System32 dll were visible. Then I was able to load the needed dll.
使用 VB.net 2015 I(无法添加甚至找不到 System32 dll)作为使用解决方案资源管理器、选项卡引用的参考。转到主菜单,项目/添加引用...使用浏览和所有 System32 dll 都可见。然后我就能够加载所需的 dll。