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?
"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.
Copying Directories with cp Command To copy a directory, including all its files and subdirectories, use the -R or -r option.
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 .
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)"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With