17

I need my C# project to launch another EXE program during execution. This executable needs to be placed in the same folder as the C# program is placed on building the solution, for example, the debug folder -- just like DLL file references -- so that when my team members check the project out from TFS, and debug, the EXE is found when my C# code tries to call it.

However, the EXE is not a reference per se, and so it cannot be added as a reference, even though I want it to be copied around in the same manner as a reference.

Is there a reasonable solution for this problem?

Thanks in advance.

4

4 回答 4

28

您可以转到文件的属性,然后在复制到输出目录下选择,copy if newer

在此处输入图像描述

于 2013-09-10T20:46:51.497 回答
5

您可以将可执行文件作为项目添加到您的 C# 项目中,并在其属性中将其属性设置Copy to Output DirectoryCopy always. 这样,每次编译项目时,可执行文件都会被复制到输出文件夹(bin\Debug或)。bin\Release

于 2013-09-10T20:46:27.967 回答
2

创建一个在构建后执行复制操作的批处理文件。可以在构建前和构建后做其他事情。请参阅http://msdn.microsoft.com/en-us/library/ke5z92ks.aspx

于 2013-09-10T20:47:15.497 回答
1

.exe与您的程序设置一起打包。

只需将其添加到Applications Folder. 它与bin/Debug文件夹中的相同。

于 2013-09-10T20:47:11.950 回答