如何使Visual Studio将所需的.dll文件复制到发行文件夹? [英] How can I make Visual Studio copy the required .dll files into the release folder?

查看:555
本文介绍了如何使Visual Studio将所需的.dll文件复制到发行文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Visual  Studio  2012 使用C ++,开发 Qt 应用程式。



I可以编译和调试,但是,不知何故,没有.dll文件是在调试发布文件夹。我已经尝试过一些其他的帖子解决方案,但没有工作。



那么,我如何使Visual Studio将所需的.dll文件复制到发布文件夹? p>

我认为它应该是一个选项。我刚刚开始考虑复制它手工制作。

解决方案

太多不好的建议,DLL不能是资源。 Windows 需求,该代码存储在具有适当PE32标头的单独的可执行文件中。它允许它创建一个内存映射文件将文件内容映射到内存,允许代码被多个进程共享,并保持它离开页面文件。



只需使用Project + Properties,Build事件,后构建事件来复制DLL即可。任意地,如果你需要的DLL存储在你的项目的dlls子目录中,那么只有在必要时,这个命令才会复制它们:

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

在调试和发布配置中使用它,因此您将正确调试要发送的内容。


I'm using Visual Studio 2012 with C++, developing a Qt application.

I'm able to compile it and debug it, but, somehow, no .dll file is in the Debug or Release folder. 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?

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. Windows demands that code is stored in a separate executable file with a proper PE32 header. 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.

Simply use Project + Properties, Build events, Post-Build Event to xcopy the DLLs. Arbitrarily, if you stored the needed DLLs in the "dlls" subdirectory of your project then this command will get them copied, only when necessary:

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

Use it both in the Debug and Release configuration so you'll debug exactly what you'll ship.

这篇关于如何使Visual Studio将所需的.dll文件复制到发行文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆