I have two projects, ProjOne.exe and 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.
I also have a ProjThree.dll that it already does that for perfectly. But this in only because the dll is referenced by ProjOne.
Any way to do this like it does with DLLs/OCXs? Or is this going to be some POST build scripting? :) If so please give examples of the script I would use.
Thanks!
Go to Project ProjTwo Properties -> Build Events --> Post-build event command line :
echo f | xcopy /y "$(TargetPath)" "$(SolutionDir)ProjOne\bin\Debug$(TargetFileName)"
When you build ProjTwo, then it copies ProjTwo.exe to Debug folder of ProjOne
I ended up using ganchito55's method and it worked great. 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
.
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.
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.
if $(ConfigurationName) == Release xcopy /y "$(TargetDir)*.*" "$(SolutionDir)ProjOne\bin\Release\"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With