Visual Studio 2010能否自动将编译文件复制到另一个目录? [英] Can Visual Studio 2010 automatically copy a compiled file to another directory?
问题描述
我有两个项目,一个VB6项目编译为一个EXE和一个MSVC ++ 2010项目,编译为一个DLL。 DLL需要与EXE文件在同一个文件夹才能正常工作。我可以让Visual Studio 2010在编译后自动将编译的DLL复制到VB6项目文件夹中吗?
I have two projects, one VB6 project which compiles to an EXE and one MSVC++2010 project which compiles to a DLL. The DLL needs to be in the same folder as the EXE file in order to work. Can I have Visual Studio 2010 automatically copy the compiled DLL to the VB6 project folder after a compilation?
推荐答案
这是使用后构建事件。这些运行一旦一个构建成功完成,并有一组方便的宏,使访问常见的输出,如编译文件,很容易
The easiest way to set this up is to use a post build event. These run once a build is successfully completed and has a set of handy macros to make access to common outputs, like compiled files, very easy
例如。下面是编译的DLL / EXE到 c:\temp
For example. Here are the steps to a compiled DLL / EXE into c:\temp
- 右键单击项目并选择属性
- 单击构建事件选项卡
- 将以下行添加到框:
copy$(TargetPath)c:\temp
- Right Click on the Project and select "Properties"
- Click on the Build Events Tab
- Add the following line to the "Post-Build" box:
copy "$(TargetPath)" c:\temp
在上面的 $(TargetPath)
是一个构建任务的主要输出的宏:通常是EXE或DLL文件。如果单击编辑后构建按钮,则宏可以查看支持的宏的完整列表。
In the above $(TargetPath)
is a macro for the primary output of a build task: typically the EXE or DLL file. If you click on the "Edit Post Build" button, then macros you can see the full list of supported macros.
这篇关于Visual Studio 2010能否自动将编译文件复制到另一个目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!