visual-studio Visual Studio 自定义构建步骤规则?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/502194/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Visual studio custom build step rule?
提问by shoosh
Using Visual Studio 2008, When I add to a C++ project a file that is not .c/.cpp/.h/.rcor anything the IDE doesn't recognize a dialog pops up which asks me if I want to create a custom build step rule for this kind of files.
使用 Visual Studio 2008,当我向 C++ 项目添加一个不是.c/.cpp/.h/.rc或任何 IDE 无法识别的文件时,会弹出一个对话框,询问我是否要为此类文件创建自定义构建步骤规则。
Does anybody know how to get to this dialog without adding a file? I can't seem to be able to find in any of the menus.
有人知道如何在不添加文件的情况下进入此对话框吗?我似乎无法在任何菜单中找到。
Edit: I know all about the .rulesfile. What I'm talking about is a GUI Dialog from within Visual Studio 2008 which allows you to create and edit these .rulesfiles. This is the dialog I mentioned which pops up when you add a file with an unknown extension.
编辑:我知道该.rules文件的所有信息。我所说的是 Visual Studio 2008 中的 GUI 对话框,它允许您创建和编辑这些.rules文件。这是我提到的对话框,当您添加具有未知扩展名的文件时会弹出该对话框。
采纳答案by Daniel LeCheminant
If you add an item with an unknown extension, you'll get a message box titled "Matching Custom Build Rule Not Found", which asks if you'd like to create a new rule file to define a custom build rule to build files with that extension. If you click "Yes", you'll get the "New Rule File" dialog.
如果添加具有未知扩展名的项目,您将收到一个标题为“未找到匹配自定义构建规则”的消息框,询问您是否要创建新规则文件来定义自定义构建规则来构建文件那个扩展。如果单击“是”,您将看到“新建规则文件”对话框。
If you'd like to just get that same "New Rule File" dialog:
如果您只想获得相同的“新规则文件”对话框:
- Right-click your project
- Select "Custom Build Rules..."
- Click the button "New Rule File..."
- 右键单击您的项目
- 选择“自定义构建规则...”
- 单击“新建规则文件...”按钮
If you're asking how to get the "Matching Custom Build Rule Not Found" message box itself, I'm not sure how you'd do that. (If that's what you're trying to do, you may want to clarify that in your question)
如果您问如何获取“未找到匹配的自定义构建规则”消息框本身,我不确定您会如何做到这一点。(如果这就是你想要做的,你可能想在你的问题中澄清这一点)

