简体   繁体   English

如何更改默认情况下在Visual Studio中具有内容构建属性的文件

[英]How do I change which files by default have build property of content in visual studio

When adding a PDF, CSV, etc... to a project I have to go to the properties of every file and change the build action to Content. 将PDF,CSV等添加到项目中时,我必须转到每个文件的属性并将构建操作更改为“内容”。

Is there a way to change the list of extensions that are recognized in a project so that this will happen when I include a pdf or csv in my project automatically. 有没有一种方法可以更改项目中可以识别的扩展名列表,以便当我在项目中自动包含pdf或csv时会发生这种情况。

Thanks, 谢谢,

This blog post by Andre Loker describes the process in great detail. Andre Loker的这篇博客文章详细介绍了该过程。 The relevant section appears to be this: 相关部分似乎是这样的:

The default build action of a file type can be configured in the registry. 可以在注册表中配置文件类型的默认生成操作。 However, instead of hacking the registry manually, we use a much better approach: pkgdef files ( a good article about pkgdef files ). 但是,与其使用手动方法破解注册表,不如使用更好的方法:pkgdef文件( 有关pkgdef文件的好文章 )。 In essence, pkdef are configuration files similar to .reg files that define registry keys and values that are automatically merged into the correct location in the real registry. 本质上,pkdef是类似于.reg文件的配置文件,这些文件定义了注册表项和值,这些注册表项和值会自动合并到真实注册表中的正确位置。 If the pkgfile is removed, the changes are automatically undone. 如果删除了pkgfile,则更改将自动撤消。 Thus, you can safely modify the registry without the danger of breaking anything – or at least, it's easy to undo the damage. 因此,您可以安全地修改注册表,而不会破坏任何内容–至少可以很容易地消除损坏。

But here's an example of what you need to set: 但是,这是您需要设置的示例:

[$RootKey$\Projects\{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\FileExtensions\.spark]
"DefaultBuildAction"="Content"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 内容文件更改时,Visual Studio自动生成增量 - Visual Studio automatic build increment when content files change 如何将自定义默认构建操作与Visual Studio中的自定义文件类型相关联? - How do I associate a custom default build action to a custom file type in Visual Studio? 如何阻止 Visual Studio 在发布版本中创建 XML 文档文件? - How do I stop Visual Studio from creating XML Documentation files in a Release build? 默认情况下如何以管理员身份运行 Visual Studio? - How do I run Visual Studio as an administrator by default? 如何在 Visual Studio 2017 中设置默认浏览器? - How do I set the default browser in Visual Studio 2017? 如何在带有XNA的Visual Studio 2010中正确引用内容? - How do I properly reference Content in Visual Studio 2010 with XNA? 如何在 Visual Studio 2010 中构建不依赖于 .NET 4 SDK DLL/库文件的可执行文件? - How do I build an executable file in visual studio 2010 that doesn't rely on the .NET 4 SDK DLL/Library files? 如何更改许多Visual Studio项目的references文件夹? - How do I change the references folder of a lot of Visual Studio projects? 在Visual Studio中调试时如何更改工作目录? - How do I change the working directory while debugging in Visual Studio? Visual Studio复制设置为“不复制”的dll文件 - Visual Studio copies dll files which are set to “Do not copy”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM