Search code examples
visual-studio-2008msbuild

Copy to Output Directory copies folder structure but only want to copy files


I have a VS2008 I want to copy certain files from a directory into my /bin/ folder. I have set the files (located in /common/browserhawk/) to "Copy to Output Directory". However, it copies the folder structure as well: the files are copied to /bin/common/browserhawk/

How do I get these files to copy to just /bin/? I do not want to store these in the root of the website to get them to copy correctly.

Related Question: Visual Studio adds .dll and .pdb to project after compiling


Solution

  • You can add a Post Build Event to copy the files.
    Go to project properties, Build Events tab and add the following to the Post-build event command line:

    copy "$(ProjectDir)\common\browserhawk\*.*" "$(TargetDir)"
    

    Be sure to include the quotes if your project path has spaces in it.