简体   繁体   English

将exe从一个项目复制到另一个项目的调试输出目录

[英]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 . 我还想在DEBUGRELEASE进行构建。

I ended up doing the following... 我最后做了以下......

1) Dig down to the project properties on ProjTwo: 1) 深入了解ProjTwo上的项目属性:

Right click on project -> Properties -> Build Events 右键单击项目 - > 属性 - > 构建事件

2) Add the following lines to the "Post-build event command line" box: 2) 将以下行添加到“Post-build event命令行”框中:

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.

相关问题 将一个项目的 output 目录中的一个文件复制到另一个项目的 output 目录 - Copy one file from a project's output directory to another project's output directory 如何将.exe从C ++项目复制到C#项目的输出目录? - How to copy .exe from C++ project to the output directory of a C# project? 从另一个项目的类获取一个项目的基本目录 - Get Base Directory of one project from another project's class Nuget包将exe内容文件复制到项目输出目录 - Nuget package to copy exe content file to project output directory 将文件从一个目录复制到另一个目录 - Copy file from one directory to another Nuget库-将库的DLL复制到当前项目的输出目录 - Nuget Library - Copy DLL of Library to current project's output directory 将项目构建到另一个输出目录中,如何从中调试? - Project build into a different output directory, how to debug from it? 将 nuget package 内容文件(类型为.exe)复制到使用该 nuget package 的项目的 output 目录 - Copy nuget package content file (of type .exe) to output directory of project using that nuget package 如何将文件从一个目录复制到另一目录? - How do i copy files from one directory to another directory? 将其他文件复制到输出目录以进行发布和调试? - Copy different file to output directory for release and debug?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM