指定一个路径为附加包含目录
// 添加头文件目录
public void AdditionalCLCompiler(string includeDirectoriesPath)
{
ThreadHelper.ThrowIfNotOnUIThread();
VCProject prj;
IVCCollection cfgs, tools;
VCConfiguration cfg;
VCCLCompilerTool tool;
DTE2 dte = Package.GetGlobalService(typeof(DTE)) as DTE2;
prj = (VCProject)dte.Solution.Projects.Item(1).Object;
cfgs = (IVCCollection)prj.Configurations;
cfg = (VCConfiguration)cfgs.Item(1);
tools = (IVCCollection)cfg.Tools;
tool = (VCCLCompilerTool)tools.Item("VCCLCompilerTool");
tool.AdditionalIncludeDirectories = includeDirectoriesPath;
}
includeDirectoriesPath为E:\VSAdd\EngineLib\include时,结果
只新建了项目,项目中没有任何C/C++项时该属性不显示。