Visual Studio自定义向导 - 添加其他配置

时间:2012-10-22 08:46:18

标签: visual-studio-2010 templates configuration build

我正在编写一个用于创建C ++项目的visual studio自定义向导。

我需要定义继承调试配置的其他构建配置。

我google了很多,但找不到任何东西。

我想这应该通过调用default.js在JScript文件(AddConfig),proj.Object.AddConfiguration函数中完成。但我找不到示例,也没有语法规则。

我发现的唯一一件事就是:http://www.codeproject.com/Articles/200039/A-Visual-Studio-Wizard-to-add-more-project-configu但它太复杂了,我无法理解。

你能帮忙吗?

1 个答案:

答案 0 :(得分:0)

找到它。可以使用C#代码完成:

solution.SolutionBuild.SolutionConfigurations.Add("Conf", "Debug", true);
//set Conf to be active build configuration
solution.SolutionBuild.SolutionConfigurations.Item("Conf").Activate();
//Get project
VCProject pro = solution.Projects.Item(1).Object;
//Get comiler tool for project
VCCLCompilerTool tool = pro.Configurations.item("Conf").Tools("VCCLCompilerTool");
//set Prprocessor definition for Conf
tool.PreprocessorDefinitions = "NEW";  
相关问题