Difference between Build action content and 'Copy to output directory' in Visual Studio
Solution 1:
When setting the Build Action
to Content
, the file will not be compiled and will be put in the Content output group.
Whether the file gets copies or not depends on the Copy to Output Directory
setting at that point.
Of course, if you set Copy Always
on a file, it may get compiled and then copied.
See File Properties on MSDN:
Content - The file is not compiled, but is included in the Content output group. For example, this setting is the default value for an .htm or other kind of Web file.
Solution 2:
The Content build action has visible effect in WPF projects (possibly ASP too).
It adds
[assembly: System.Windows.Resources.AssemblyAssociatedContentFileAttribute("filename")]
to WpfApplication1_Content.g.cs
. Read about AssemblyAssociatedContentFileAttribute
.
In WinForms and console application (what OP may be using) it does not do this, so there's no difference to None action when building.
In this comment, I've found also a note about effect on deployment:
Also note that Content will be included when using one-click deploy, but None won't even if "copy if newer" is selected.
Possibly this works even for console and WinForms applications (I haven't tried).
Solution 3:
Copy Always will also trigger a rebuild of that project in a solution even if no code has changed.