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

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.


Since I cannot comment on previous answers, I will put the solution here:

Adding to what @PaulAlexander provided, add the following to your .csproj/.vbproj file:

<ItemGroup>
    <AvailableItemName Include="RootContent">
      <Visible>false</Visible>
    </AvailableItemName>  
</ItemGroup>
<Target Name="AfterBuild">
    <Copy
        DestinationFolder="$(OutputPath)"
        SourceFiles="@(RootContent)"
        SkipUnchangedFiles="true"
        />  
</Target>

This allows you to select "RootContent" as the Build Action in the Properties window, and all can be accessed via the GUI. A more complete explanation: the "AvailableItemName" option basically creates a new named-list that you can assign items in the project to under the "Build Action" property in the Properties window. You can then use this newly created list in any Target you like (eg via "@(RootContent)").


If you edit the .csproj / .vbproj in a text editor, you can control where the file is placed in the output directory, and also what name the file will have in the output directory. For example:

<None Include="content\someContent.txt">
  <Link>someContentInOutputDirectory.txt</Link>
  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

This will put the file content\someContent.txt into bin\someContentInOutputDirectory.txt. You can also choose a subdirectory in bin if you want; simply add it to the Link element.