简体   繁体   English

如何将.exe从C ++项目复制到C#项目的输出目录?

[英]How to copy .exe from C++ project to the output directory of a C# project?

Say you have a Visual Studio solution containing 2 projects: 假设您有一个包含2个项目的Visual Studio解决方案:

  1. Project A: C++ console application 项目A:C ++控制台应用程序
  2. Project B: C# console application 项目B:C#控制台应用程序

Project B depends upon the output .exe of Project A. Is there a way to set this .exe to be automatically copied to Project B's output folder during build? 项目B依赖于项目A的输出.exe 。有没有办法将此.exe设置为在构建期间自动复制到Project B的输出文件夹?

You can use Buildevents in the properties for the project. 您可以在项目的属性中使用Buildevents。

Here you can define Post and Prebuild Tasks with Wildcards. 在这里,您可以使用通配符定义Post和Prebuild Tasks。

like: 喜欢:

copy "$(TargetPath)" "$(SolutionDir)UploaderClient\bin\Debug\Plugins\$(TargetFileName)"

Yes, in VS go into the project properties for A. Look under "Configuration Properties" for a sub item of "Build Events", expand that and add a "Post-Build Event". 是的,在VS中进入A的项目属性。在“配置属性”下查找“构建事件”的子项,展开它并添加“构建后事件”。 These are simple dos commands, so you can just copy the .exe where-ever you want. 这些是简单的dos命令,因此您可以在任何地方复制.exe。

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

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