Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio - sending "content" files to the output directory instead of a subdirectory? [duplicate]

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

I'm using VS2010. I've got a C# project that uses a few native DLLs. In my source tree, I have these native files stored in a "DLLs" directory underneath the main solution directory. In my C# project, I have the "DLLs" folder listed with each of the DLLs inside it. Each DLL is set to build action "Content" and "Copy to Output" set to "Always".

Unfortunately, because these files are in a subdirectory, VS seems to think they should be deployed that way. Instead of being deployed to \bin\Debug, they're being deployed to \bin\Debug\DLLs. Is there any straightforward way to convince VS to deploy them directly to \bin\Debug, or will I have to do some kind of custom build action to copy them into place?

like image 608
markerikson Avatar asked Jun 28 '10 17:06

markerikson


People also ask

What does Copy to Output directory do?

"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.

How do I copy a file in subdirectories?

Copying Directories with cp Command To copy a directory, including all its files and subdirectories, use the -R or -r option.

How do I copy content from one folder to another?

Copy and paste files Select the file you want to copy by clicking on it once. Right-click and pick Copy, or press Ctrl + C . Navigate to another folder, where you want to put the copy of the file. Click the menu button and pick Paste to finish copying the file, or press Ctrl + V .


1 Answers

This is because you've got them in a Folder in the solution. The pragmatic solution is to simply add them to the solution root, the actual location of the file doesn't matter. That perhaps creates a wee bit of clutter in your Solution Explorer window. If that's unacceptable then a pre-build event that uses xcopy /d is the workaround.

xcopy /d "$(ProjectDir)DLLs\*.dll" "$(TargetDir)"

like image 116
Hans Passant Avatar answered Sep 27 '22 17:09

Hans Passant