Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 971
Steve Wright Avatar asked Jun 18 '09 17:06

Steve Wright


People also ask

How do I copy a folder structure but not contents?

Type "xcopy", "source", "destination" /t /e in the Command Prompt window. Instead of “ source ,” type the path of the folder hierarchy you want to copy. Instead of “ destination ,” enter the path where you want to store the copied folder structure. Press “Enter” on your keyboard.

Can you copy just folder structure without files?

It's the /T option that copies just the folder structure not the files. You can also use the /E option to include empty folders in the copy (by default empty folders will not be copied).

What does copy to Output directory mean?

"Copy to Output Directory" is the property of the files within a Visual Studio project, which defines if the file will be copied to the project's built path as it is. Coping the file as it is allows us to use relative path to files within the project.


1 Answers

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.

like image 170
Bill A. Avatar answered Oct 14 '22 23:10

Bill A.