I'm writing a .NET Core 2 console app where i have some files i want to be copied to the output directory. I set the "Copy to output directory" to true and the build action to "Embedded Resource". The file gets copied to the directory like a charm. However, it also does so if i set the build action to "Content".
The official Microsoft docs say:
- Content: A file marked as Content can be retrieved as a stream by calling Application.GetContentStream. For ASP.NET projects, these
files are included as part of the site when it's deployed.- Embedded Resource: The file is passed to the compiler as a resource to be embedded in the assembly. You can call System.Reflection.Assembly.GetManifestResourceStream to read the file from the assembly.
So i thought if I set the build action to "Content", the file will get copied automatically to the output directory without having to set the flag "Copy to output directory" explicitly. But this doesn't seem to be the case.
So what does "Content" actually do, and when do I have to use it instead of "Embedded resource"? An example on when to use "Content" and when to use "Embedded resource" would be great.