views:

555

answers:

2

Hi!

I have a Visual Studio C++ project that relies on an external dll file. How can I make Visual Studio copy this dll automatically into the output directory (debug/release) when i build the project?

Thanks!

+2  A: 

Set Copy Local to True under the properties for the referenced assembly.

mattruma
i don't have referenced assemblies - i added the include path of the header files to the C++/Default settings and the path of the lib to the Linker/Default settings
Mat
I have seen those referenced assemblies already in some .Net projects - but this is a C++ project - how to do it here?
Mat
+3  A: 

use a post-build action in your project, and add the commands to copy the offending dll. the post-build action are written as a batch script.

the output directory can be referenced as $(OutDir). the project directory is available as $(ProjDir). try to use relative pathes where applicable, so that you can copy or move your project folder without breaking the post-build action.

Adrien Plisson
It's also worth pointing out that he can set the post-build event via Project > Properties > Build Events > Post-Build Event.
Phil Booth
Works! :) thank you!
Mat