Visual Studio 宏列出项目而不是解决方案文件夹
使用以下代码为我提供了解决方案文件夹而不是真实的项目。
projectName = DTE.Solution.SolutionBuild.StartupProjects(0)
For Each project In DTE.Solution.Projects
If project.UniqueName = projectName Then
Return project
End If
Next
有没有办法可以循环遍历实际的项目节点?
我正在尝试从启动项目中读取属性。
Using the following code gives me Solution folders instead of real projects.
projectName = DTE.Solution.SolutionBuild.StartupProjects(0)
For Each project In DTE.Solution.Projects
If project.UniqueName = projectName Then
Return project
End If
Next
Is there way I can loop through actual Project nodes?
I'm trying to read properties from the startup project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我从未编写过任何 Visual Studio 宏,但这可能正是您正在寻找的。
我在那里留下了一个“TODO”,因为如果您想要处理嵌套(子)项目,您需要将其实际拉到一个可以递归调用的函数中。
我从 此链接< /a>,虽然它是 Visual Studio 2005 时代的材料,但它可能会让您朝着正确的方向前进。
I've never written any Visual Studio macros, but this may be what you are looking for.
I left a 'TODO in there, because you would need to actually pull this out into a function that you could recursively call if you are looking to deal with nested (sub) projects.
I got this solution from this link, and while it's Visual Studio 2005-era material, it might get you going in the right direction.
我认为您可能想检查 VS 常量,请尝试以下操作:
它是我的博客中的较大宏的一部分,网址为 http://www.brianschmitt.com/2009/10/fixing-visual-studio-add-reference.html
I think you may want to check against the VS constants, try the following:
Its part of a larger macro from my blog at http://www.brianschmitt.com/2009/10/fixing-visual-studio-add-reference.html
要从解决方案文件夹获取项目,请使用属性 ProjectItem.SubProject
To Get the Project from Solution folder, use the property ProjectItem.SubProject