In Visual Studio, how can I set the Build Action for an entire folder?

Create the project. Add one file as Content. Unload the project and edit the *proj file manually.

 <ItemGroup>
    <Content Include="myfolder**\*.dll**">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

And then in the content-ItemGroup I would replace that singe file with some MsBuild wildcard expression, *.dll, or whatever.


I use Visual Studio 2012 and you can shift-click to select multiple items in the Solution Explorer then edit each item's Copy To Output Directory property all at once in the Properties window.

Granted this isn't equivalent to the solution you are looking for functionally, but semantically it is. And hopefully the next person to stumble across this post with a humongous folder to remedy (as is with me) won't have to dive into the .csproj file.

Hope this helps!


If you happen to have the need to set the Build Action for an entire folder the best option is to just open the .csproj file and use a regex to replace all the occurences from

<Content ....

to

<None ...

That worked just perfectly for me.