![](/img/trans.png)
[英]Copy one file from a project's output directory to another project's output directory
[英]Copy exe from one project to another's debug output directory
我有两个项目,ProjOne.exe和ProjTwo.exe。 我想构建ProjOne.exe,它知道它依赖于ProjTwo.exe,因此它会在构建ProjOne.exe时复制ProjTwo.exe。
我还有一个ProjThree.dll,它已经完美地完成了它。 但这仅仅是因为Proll引用了dll。
有没有像DLL / OCX那样做的方法? 或者这是一些POST构建脚本? :)如果是这样,请举例说明我将使用的脚本。
谢谢!
转到项目ProjTwo属性 - > 构建事件 - > 构建后事件命令行 :
echo f | xcopy /y "$(TargetPath)" "$(SolutionDir)ProjOne\bin\Debug$(TargetFileName)"
当您构建ProjTwo时,它会将ProjTwo.exe复制到ProjOne的Debug文件夹中
我最终使用ganchito55的方法,它工作得很好。 然后我很快意识到在处理多个文件(例如调试文件等)时它不适合我的目的。 我还想在DEBUG
和RELEASE
进行构建。
我最后做了以下......
右键单击项目 - > 属性 - > 构建事件
在构建DEBUG
输出时,将ProjTwo中使用的所有文件复制到ProjOne输出目录。
if $(ConfigurationName) == Debug xcopy /y "$(TargetDir)*.*" "$(SolutionDir)ProjOne\bin\Debug\"
在构建RELEASE
输出时,将ProjTwo中使用的所有文件复制到ProjOne输出目录。
if $(ConfigurationName) == Release xcopy /y "$(TargetDir)*.*" "$(SolutionDir)ProjOne\bin\Release\"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.