[英]Copy exe from one project to another's debug output directory
I have two projects, ProjOne.exe and ProjTwo.exe. 我有两个项目,ProjOne.exe和ProjTwo.exe。 I want to build ProjOne.exe and it know that it's dependant on ProjTwo.exe so that it will copy ProjTwo.exe when it goes to build ProjOne.exe.
我想构建ProjOne.exe,它知道它依赖于ProjTwo.exe,因此它会在构建ProjOne.exe时复制ProjTwo.exe。
I also have a ProjThree.dll that it already does that for perfectly. 我还有一个ProjThree.dll,它已经完美地完成了它。 But this in only because the dll is referenced by ProjOne.
但这仅仅是因为Proll引用了dll。
Any way to do this like it does with DLLs/OCXs? 有没有像DLL / OCX那样做的方法? Or is this going to be some POST build scripting?
或者这是一些POST构建脚本? :) If so please give examples of the script I would use.
:)如果是这样,请举例说明我将使用的脚本。
Thanks! 谢谢!
Go to Project ProjTwo Properties -> Build Events --> Post-build event command line : 转到项目ProjTwo属性 - > 构建事件 - > 构建后事件命令行 :
echo f | xcopy /y "$(TargetPath)" "$(SolutionDir)ProjOne\bin\Debug$(TargetFileName)"
When you build ProjTwo, then it copies ProjTwo.exe to Debug folder of ProjOne 当您构建ProjTwo时,它会将ProjTwo.exe复制到ProjOne的Debug文件夹中
I ended up using ganchito55's method and it worked great. 我最终使用ganchito55的方法,它工作得很好。 I then quickly realized that it would not suit my purposes when dealing with multiple files (such as debug files, etc).
然后我很快意识到在处理多个文件(例如调试文件等)时它不适合我的目的。 I also wanted to account for building in
DEBUG
and RELEASE
. 我还想在
DEBUG
和RELEASE
进行构建。
I ended up doing the following... 我最后做了以下......
Right click on project -> Properties -> Build Events 右键单击项目 - > 属性 - > 构建事件
Copy ALL files used in the ProjTwo to the ProjOne output directory when building DEBUG
output. 在构建
DEBUG
输出时,将ProjTwo中使用的所有文件复制到ProjOne输出目录。
if $(ConfigurationName) == Debug xcopy /y "$(TargetDir)*.*" "$(SolutionDir)ProjOne\bin\Debug\"
Copy ALL files used in the ProjTwo to the ProjOne output directory when building RELEASE
output. 在构建
RELEASE
输出时,将ProjTwo中使用的所有文件复制到ProjOne输出目录。
if $(ConfigurationName) == Release xcopy /y "$(TargetDir)*.*" "$(SolutionDir)ProjOne\bin\Release\"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.