Visual Studio生成后事件-复制到相对目录位置 [英] Visual Studio Post Build Event - Copy to Relative Directory Location

查看:235
本文介绍了Visual Studio生成后事件-复制到相对目录位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在成功构建后,我希望将输出目录的内容复制到同一基本" 文件夹下的其他位置.此父文件夹是相对的,可以根据源代码管理设置而有所不同.

On a successful build, I wish to copy the contents of the output directory to a different location under the same "base" folder. This parent folder is a relative part and can vary based on Source Control settings.

我列出了一些可供我使用的宏值...

I have listed a few of the Macro values available to me ...

$(SolutionDir)= D:\ GlobalDir \ Version \ AppName \ Solution1 \ build

$(SolutionDir) = D:\GlobalDir\Version\AppName\Solution1\build

$(ProjectDir)= D:\ GlobalDir \ Version \ AppName \ Solution1 \ Version \ ProjectA \

$(ProjectDir) = D:\GlobalDir\Version\AppName\Solution1\Version\ProjectA\

我想将输出目录的内容复制到以下文件夹:

I want to copy the Output Dir contents to the following folder :

D:\ GlobalDir \ Version \ AppName \ Solution2 \ Project \ Dependency

D:\GlobalDir\Version\AppName\Solution2\Project\Dependency

需要从上述宏之一中获取基本位置"D:\ GlobalDir \ Version \ AppName".但是,所有宏值都不会列出父级位置.

The base location "D:\GlobalDir\Version\AppName" needs to be fetched from one of the above macros. However, none of the macro values list only the parent location.

如何仅提取构建后复制命令的基本位置?

How do I extract only the base location for the post build copy command ?

推荐答案

如果TargetDir或其他宏都没有指向正确的位置,请使用".."目录向后追溯文件夹层次结构.

If none of the TargetDir or other macros point to the right place, use the ".." directory to go backwards up the folder hierarchy.

即.使用$(SolutionDir)\..\..获取您的基本目录.

ie. Use $(SolutionDir)\..\.. to get your base directory.

有关所有宏的列表,请参见此处:

For list of all macros, see here:

http://msdn.microsoft.com/en-us/library/c02as0cs.aspx

这篇关于Visual Studio生成后事件-复制到相对目录位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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