I have a Visual Studio C++ project that relies on an external DLL file. How can I make Visual Studio copy this DLL file automatically into the output directory (debug/release) when I build the project?
Visual-studio – How to make Visual Studio copy a DLL file to the output directory
dllvisual c++visual studio
Related Topic
- Visual-studio – How to run Visual Studio post-build events for debug build only
- Visual-studio – How to add an existing directory tree to a project in Visual Studio
- Visual-studio – Open two instances of a file in a single Visual Studio session
- C# – How to remedy “The breakpoint will not currently be hit. No symbols have been loaded for this document.” warning
- .net – How to fix the Visual Studio compile error, “mismatch between processor architecture”
- Visual-studio – Can you force Visual Studio to always run as an Administrator in Windows 8
- Visual-studio – Error message “No exports were found that match the constraint contract name”
Best Answer
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.