How to include other files to the output directory in C# upon build?

You can add files to your project and select their properties: "Build Action" as "Content" and "Copy to output directory" as "Copy Always" or Copy if Newer (the latter is preferable because otherwise the project rebuilds fully every time you build it).

Then those files will be copied to your output folder.

This is better than using a post build step because Visual Studio will know that the files are part of the project. (That affects things like ClickOnce applications which need to know what files to add to the clickonce data.)

You will also be more easily able to see which files are in the project because they will be listed with the source code files rather than hidden in a post-build step. And also Source Control can be used with them more easily.

Once you have added "Content" files to your project, you will be able to add them to a Visual Studio 2010 Setup and Deployment project as follows:

Go into your Setup project and add to your "Application Folder" output the Project Output called "Content Files". If you right-click the Content Files after adding them you can select "outputs" and see what it's going to copy.

Note that Setup and Deployment projects are NOT supported in Visual Studio 2012.


You can use Visual Studio Post Build Event - Copy to Relative Directory Location. Which are basically scripts that are executed on build of specified project.

So you can use it to copy binaries you need, before actually running your application.