Build Events 执行copy 命令路径限制

编写项目Build Events的Pre-build、Post-build时如果使用copy命令必须为绝对路径,比如预定义宏OutDir,编写如下命令:

copy "$(SolutionDir)BuildLibrary" "$(OutDir)"

得到exit code 1的提示,因为$(OutDir)返回相对路径,比如:“Bin\Debug\”。相对路径无法成功执行,只需要修改为如下命令:

copy "$(SolutionDir)BuildLibrary" "$(TargetDir)"
原文地址:https://www.cnblogs.com/junchu25/p/2697638.html