C# 中外部 DLL 放置在哪里?
如果我通过以下方式在 C# 中引用外部非托管 DLL:
[DLLImport("MyDLL.dll", ...
当我想从 IDE 运行代码时,该 DLL 应该放在哪里?它应该位于 bin\Debug
文件夹中吗?
If I reference an external unmanaged DLL in C# by the following:
[DLLImport("MyDLL.dll", ...
Where should the DLL be placed when I want to run the code from my IDE? Should it be in the bin\Debug
folder?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您正在使用哪种编译配置?
如果你想从 Visual Studio 调试/运行运行应用程序,它将位于你的项目文件夹中。
如果你想通过双击运行,它应该位于
bin\Debug
或
bin\Release
文件夹中的 exe 附近。
Which compiling configuration you are using?
If you want to run the application from Visual Studio Debug/Run it would be in your project folder
If you want to run by double click, it should be near your exe which is in
bin\Debug
or
bin\Release
folder.
LoadLibrary
函数。有关详细信息,请参阅动态链接库搜索顺序 :bin\Debug
满足第一点,假设您仅在其Debug
配置中运行应用程序。Anywhere locatable by the
LoadLibrary
function. See Dynamic-Link Library Search Order for more information:bin\Debug
satisfies the first point, assuming that you're only ever running the application in itsDebug
configuration.是的,除了编译器生成的
.exe
文件(如您所说,最终位于bin\Debug\
中)应该是完美的。Yes, alongside the
.exe
file produced by the compiler (which ends up inbin\Debug\
as you said) should be perfect.