VC++项目“包含在项目中"以编程方式 [英] VC++ project "Include in project" programmatically

查看:33
本文介绍了VC++项目“包含在项目中"以编程方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法通过 VCProject 或 EnvDTE 接口以编程方式将文件夹包含到 VC++ 项目中?

Is there a way to include folder into VC++ project programmatically via VCProject or EnvDTE interface?

推荐答案

查看示例宏 - View ->其他窗口 ->宏资源管理器.Samples/AddDirAsSlnFolder 中有一个向您展示了如何在项目中创建节点和添加文件.它在 VisualBasic 中,但是一旦您看到使用了 EnvDTE 中的哪些方法,就很容易将其转换为 C#,例如

Take a look at the sample macros - View -> Other Windows -> Macro Explorer. There's one in Samples/AddDirAsSlnFolder which shows you how to create nodes in a project and add files. It's in VisualBasic, but it's pretty easy to translate into C# once you see which methods in EnvDTE are used, eg

projItem = currentSlnFolder.Parent.ProjectItems.AddFromFile(file)

使用EnvDTE.ProjectItems

这篇关于VC++项目“包含在项目中"以编程方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆