Page 1 of 1

How to copy files to the MSVC 2010 output directory

PostPosted: Sun Sep 26, 2010 6:43 pm
by fips
It's a typical task that one needs to automatically copy a 3rd party file (e.g. a DLL library) to the project's output directory as a post-build step. Here's how it can be achieved in Microsoft Visual Studio 2010 (MSBuild). Let's assume we have a file structure like this:
.../External/glew_1_5_5/lib/glew32.dll (source)
.../Game/Game.vcxproj (project file)
.../Game/{Debug or Release}/glew32.dll (destination)

It's quite simple, we just need to edit 'Game.vcxproj' and add the following lines to the end:
 <!-- BEGIN -->
 <Target Name="AfterBuild" > 
  <Copy SourceFiles="..\..\External\glew_1_5_5\lib\glew32.dll" DestinationFolder="$(OutDir)"></Copy> 
 <!-- END -->