简体   繁体   中英

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:

  1. Project A: C++ console application
  2. Project B: C# console application

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?

You can use Buildevents in the properties for the project.

Here you can define Post and Prebuild Tasks with Wildcards.

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". These are simple dos commands, so you can just copy the .exe where-ever you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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