简体   繁体   English

使用外部EXE作为启动项目

[英]Use external EXE as startup project

I have a solution which contains a few projects and an external exe. 我有一个包含几个项目和一个外部exe的解决方案。 When I build, I want to copy the exe to my build folder, as well as build the projects and copy my dlls to the build folder. 生成时,我想将exe复制到我的生成文件夹,以及生成项目并将dll复制到生成文件夹。 Is there any way to run this external exe as my post-build event? 有什么办法可以将此外部exe作为生成后事件运行? So, when I run my solution in visual studio, I would like to basically set the external exe as the startup project. 因此,当我在Visual Studio中运行解决方案时,我基本上希望将外部exe设置为启动项目。 Is this possible (or something similar)? 这可能(或类似的东西)吗?

You don't want to run it while building, you want to run it when you start debugging. 您不想在构建时运行它,而是想在开始调试时运行它。 First get the .exe copied to the build directory with Project + Add Existing Item. 首先使用Project + Add Existing Item将.exe复制到构建目录。 Select the .exe. 选择.exe。 Set its Copy to Output Directory property to "Copy if newer". 将其“复制到输出目录”属性设置为“如果更新则复制”。 Build + Rebuild. 构建+重建。

Then select it as your startup EXE with Project + Properties, Debug tab. 然后使用“项目+属性”的“调试”选项卡将其选择为启动EXE。 Select the "Start external program" radio button and select the .exe in your bin\\debug directory. 选择“启动外部程序”单选按钮,然后在bin \\ debug目录中选择.exe。 Press F5 to get it going with the debugger attached. 按F5使其与调试器一起运行。

Add the EXE to your project as a file. 将EXE作为文件添加到您的项目中。 right click the EXE properties. 右键单击EXE属性。 set "Copy to Output Directory" to "Copy Always" 将“复制到输出目录”设置为“始终复制”

Then in the properties of your project, under the Debug tab, set start external program and pick your EXE. 然后在项目的属性中的“调试”选项卡下,设置“启动外部程序”并选择您的EXE。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM