views:

1810

answers:

4

If I have some files I want to copy from my project into the bin\debug\ folder on compilation then it seems I have to put them into the root of the project - putting them into a subfolder seems to copy them into the bin\debug\ folder in the same structure they're stored in.

Is there any way to avoid this?

===

Just to be clear. If I have a "MyFirstConfigFile.txt" and "MySecondConfigFile.txt" in a "ConfigFiles" folder and I set their "Copy to Output" to be "Copy..." then they appear in the \bin\debug\ConfigFiles\ folder. I want them to appear in the \bin\debug\ folder.

+3  A: 

You can use a MSBuild task on your csproj, like that.

Edit your csproj file

  <Target Name="AfterBuild">
    <Copy SourceFiles="$(OutputPath)yourfiles" DestinationFolder="$(YourVariable)" ContinueOnError="true" />
  </Target>
Jhonny D. Cano -Leftware-
This is helpful, too: http://msdn.microsoft.com/en-us/library/c02as0cs.aspx
Eric Willis
+1  A: 

You could do this with a post build event. Set the files to no action on compile, then in the macro copy the files to the directory you want.

Here's a post build Macro that I think will work by copying all files in a directory called Configuration to the root build folder:

copy $(ProjectDir)\Configuration\* $(ProjectPath)\$(OutDir)
JoshBerke
+1  A: 

You want to use a Post-Build event on your project. You can specify the output there and there are macro values for frequently used things like project path, item name, etc.

Nebakanezer
A: 

You can use the PostBuild event of the project. After the build is completed, you can run a DOS batch file and copy the desired files to your desired folder.

Kirtan