3

Say I create a visual studio class project A which is a wrapper around an exe. Getting the exe to be copied to the output directory is easy.

Now I create another project B that references the class A. Is there a way to set up project A such that project B will also copy the exe to the output directory when compiling? Like the exe to be a sort of "copy local dependency" of project A.

Thanks

Charles

Charles
  • 463
  • 2
  • 6
  • 15

1 Answers1

7

Right, this is one way to do it. Will work if you have them both in the same solution in Visual Studio.

  1. Add the reference Project A to Project B. (Or vice versa if I missunderstood you)
  2. Right click the solution and select properties.
  3. In Common properties you select Project dependencies.
  4. In the project drop down select Project B and check Project A in "Depends on"-Checked listbox. (or vice versa)
  5. Build project.

You should now have Project A.exe in Project B output folder.

To add an existing exe, which isn't inside your solution, you add the exe as a reference to your project.

WozzeC
  • 2,630
  • 1
  • 13
  • 12
  • Thanks! That seems to be working like a charm for two projects in the same solution. Is there any trick you are aware of that would apply to an external project? – Charles Nov 09 '12 at 11:20
  • Have a look at this SO thread. It might be what you are looking for. http://stackoverflow.com/questions/747941/visual-studio-copying-files-into-the-application-folder-at-compile-time – WozzeC Nov 09 '12 at 11:43
  • That's a bit manual, but at least it will keep the version of the exe in sync with the dll. thanks! – Charles Nov 09 '12 at 12:10
  • I actually just found out that you can put an .exe as a reference in your project. This will put it in the debug/release folder when it is built. – WozzeC Nov 09 '12 at 12:16
  • Not any exe unfortunately. It has to be able to read some metadata from the file somehow. I tried this exercise with ffmpeg and it failed. – Charles Nov 09 '12 at 17:20