None – The file is not included in the project output group and is not
compiled in the build process. An example is a text file that contains
documentation,such as a Readme file.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.
但是由于None或Content元素都可以包含CopyToOutputDirectory元素,因此我想知道我是否将它设置为Always,不会将None和Content的行为相同吗?
解决方法
File1---CopyToOutputDirectory = Copy always,Content File2---CopyToOutputDirectory = Copy always,Content File3---CopyToOutputDirectory = Copy always,None
所有三个文件都将复制到输出目录,但只有File1和File2将被复制到内容输出组.
此外,Content允许您通过Application.GetContentStream(URI)检索文件(与程序集在同一目录中)作为流.要使此方法起作用,它需要一个AssemblyAssociatedContentFile自定义属性,当您将文件标记为内容时,Visual Studio会慷慨地添加该属性.
None和Content是文件如何与构建和部署过程相关的值.因此,您的构建(例如,MS Build)和部署可能与仅从输出目录中获取文件非常不同.您可能在输出目录中有一个您不需要的.bat文件,但是您需要它来进行部署.
This SO答案提供了有关不同构建操作的更多详细信息.