生成操作内容与Visual Studio中“复制到输出目录"之间的区别 [英] Difference between Build action content and 'Copy to output directory' in Visual Studio
问题描述
在Visual Studio的项目中,我有一些要包含在输出中但未编译或嵌入的文件.
In my project in Visual Studio, I have files that I want included in the output, but not compiled or embedded.
我知道有两种方法可以做到这一点.
I am aware that there are 2 ways to accomplish this.
- 将文件的构建操作设置为内容"
- 将复制到输出目录"设置为始终复制"或如果更新则复制"
有人可以告诉我区别是什么,每个选项都适合哪种情况?
Can someone tell me what the difference is and which scenario is each of the options appropriate for?
推荐答案
将Build Action
设置为Content
时,将不编译该文件,并将其放在内容"输出组中.
When setting the Build Action
to Content
, the file will not be compiled and will be put in the Content output group.
文件是否获得副本取决于此时的Copy to Output Directory
设置.
Whether the file gets copies or not depends on the Copy to Output Directory
setting at that point.
当然,如果在文件上设置Copy Always
,它可能会 被编译并然后被复制.
Of course, if you set Copy Always
on a file, it may get compiled and then copied.
请参见MSDN上的文件属性:
内容-该文件未编译,但包含在内容"输出组中.例如,此设置是.htm或其他类型的Web文件的默认值.
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.
这篇关于生成操作内容与Visual Studio中“复制到输出目录"之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!