[英]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文件在Debug或Release文件夹中。 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.