简体   繁体   English

如何让Visual Studio将所需的.dll文件复制到release文件夹中?

[英]How can I make Visual Studio copy the required .dll files into the release folder?

I'm using Visual Studio 2012 with C++, developing a Qt application. 我正在使用Visual Studio 2012和C ++开发Qt应用程序。

I'm able to compile it and debug it, but, somehow, no .dll file is in the Debug or Release folder. 我能够编译并调试它,但是,不知何故,没有.dll文件在DebugRelease文件夹中。 I've tried some of other posts solutions, but none worked. 我已经尝试过其他一些帖子解决方案,但都没有效果。

So, how can I make Visual Studio copy the required .dll files into the release folder? 那么,我如何让Visual Studio将所需的.dll文件复制到release文件夹中?

I think it should be an option somewhere. 我认为它应该是一个选择。 I'm just starting to think about copying it handmade. 我刚刚开始考虑手工复制它。

Too much bad advice, a DLL cannot be a resource. 太糟糕的建议,DLL不能成为资源。 Windows demands that code is stored in a separate executable file with a proper PE32 header. Windows 要求代码存储在具有适当PE32标头的单独可执行文件中。 Which permits it to create a memory-mapped file to map the file content into memory, allowing the code to be shared by multiple processes and keeping it out of the paging file. 这允许它创建一个内存映射文件来将文件内容映射到内存中,允许代码由多个进程共享并使其远离页面文件。 And to relocate the code when the DLL's base address is already in use. 并在DLL的基地址已被使用时重新定位代码。

Simply use Project + Properties, Build events, Post-Build Event to xcopy the DLLs. 只需使用Project + Properties,Build事件,Post-Build事件来复制DLL。 Arbitrarily, if you stored the needed DLLs in the "dlls" subdirectory of your project then this command will get them copied, only when necessary: 任意地,如果您将所需的DLL存储在项目的“dlls”子目录中,那么此命令将仅在必要时复制它们:

 xcopy /d /y "$(ProjectDir)dlls\*.*" "$(OutDir)"

Use it both in the Debug and Release configuration so you'll debug exactly what you'll ship. 在Debug和Release配置中使用它,这样您就可以准确地调试您要发布的内容。

Add your .dll files as resources to your project. .dll文件作为资源添加到项目中。 In this way your .dll files will be in a resources folder in you project. 这样,您的.dll文件将位于项目的resources文件夹中。

Try Add Item... -> New Item... and add a resource ( .qrc ) file to the project and add the .dll files to that. 尝试Add Item... - > New Item...并将一个资源( .qrc )文件添加到项目中并将.dll文件添加到该项目中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何设置Visual Studio将所需的DLL文件复制到发行版本的发行目录中? - How to setup Visual Studio to copy required DLL files into the release directory in a release build? 在Visual Studio '13中,我该怎么做,以便可以在exe的相对子文件夹中包含dll文件? - In visual studio '13 how do I make it so I can include dll files in a relative sub folder of my exe? 如何在Visual Studio 2010 C ++中使用所需的.dll和lib(opencv)文件制作.exe文件包 - How to make package of .exe file with required .dll and lib (opencv) files in visual studio 2010 C++ 在Visual Studio 2012上构建DLL版本时需要入口点 - entry point required when building dll release on visual studio 2012 我可以使Visual Studio将调试DLL创建为XXXd.DLL而不是XXX.DLL吗? - Can I make Visual Studio create the Debug DLL as XXXd.DLL instead of XXX.DLL? 如何告诉 Visual Studio 我的其他 .dll 文件在哪里? - How can I tell Visual studio where my additional .dll files are? 如何使我的应用程序使用Visual Studio查找第三方DLL? - How can I make my application find a third-party DLL using Visual Studio? 如何确保在修改.h文件时,使用Visual Studio 2008在Release版本中自动编译包括它的.cc文件? - How do I make sure that when a .h file is modified, the .cc files including it are compiled automatically in a Release build using Visual Studio 2008? 我无法使用 C++ 复制文件夹中的所有文件 - I can not make a copy of all the files inside a folder with C ++ 如何在Windows 10 Visual Studio中使用必需的.dll进行构建 - How to build with required `.dll` in Windows 10 Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM