如何让 Visual Studio 将 DLL 文件复制到输出目录? [英] How to make Visual Studio copy a DLL file to the output directory?

查看:61
本文介绍了如何让 Visual Studio 将 DLL 文件复制到输出目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个依赖于外部 DLL 文件的 Visual Studio C++ 项目.构建项目时,如何让 Visual Studio 自动将此 DLL 文件复制到输出目录(调试/发布)中?

I have a Visual Studio C++ project that relies on an external DLL file. How can I make Visual Studio copy this DLL file automatically into the output directory (debug/release) when I build the project?

推荐答案

在您的项目中使用构建后操作,并添加命令以复制有问题的 DLL.构建后操作编写为批处理脚本.

Use a post-build action in your project, and add the commands to copy the offending DLL. The post-build action are written as a batch script.

输出目录可以被引用为$(OutDir).项目目录以 $(ProjDir) 形式提供.尝试在适用的情况下使用相对路径,以便您可以复制或移动项目文件夹而不会中断构建后操作.

The output directory can be referenced as $(OutDir). The project directory is available as $(ProjDir). Try to use relative pathes where applicable, so that you can copy or move your project folder without breaking the post-build action.

这篇关于如何让 Visual Studio 将 DLL 文件复制到输出目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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