Copy exe from one project to another's debug output directory

后端 未结 2 1259
忘掉有多难
忘掉有多难 2021-01-02 07:18

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

相关标签:
2条回答
  • 2021-01-02 07:32

    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...

    1) Dig down to the project properties on ProjTwo:

    Right click on project -> Properties -> Build Events

    2) Add the following lines to the "Post-build event command line" box:

    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\"
    
    0 讨论(0)
  • 2021-01-02 07:49

    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

    0 讨论(0)
提交回复
热议问题