项目名称在Visual Studio解决方案有时是空的 [英] Project Names in Visual Studio Solution sometimes are empty

查看:219
本文介绍了项目名称在Visual Studio解决方案有时是空的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio中的扩展我想获得所有的项目和他们的名字:

In visual studio extension I would like to get all projects and their names:

var service = (DTE) Package.GetGlobalService(typeof (SDTE));
var projects = service.Solution.Projects;

foreach (Project project in projects)
//....

这方法很好的工作利落的一个小问题的例外:
项目变量返回的项目真正确切的数字。但是,如果它位于该解决方案的文件夹项目的全名可能为空。 (我指的是解决方案的结构时,项目解决方案的文件夹中联)

This approach work nice and neat for exception of one little problem: project variable returns really exact number of project. But project's full name might be EMPTY if it located in the solution's folder. (I mean the structure of solution when projects are united in the solution's folder)

如何正确地获得这些项目呢?

How to get these project properly?

推荐答案

下面是一个解决方案。
这家伙是环作为最小的主:
http://www.wwwlicious.com/2011/03/29/envdte-getting-all-projects-html/

Here is a solution. This guy is the Lord of Rings as minimum: http://www.wwwlicious.com/2011/03/29/envdte-getting-all-projects-html/

这篇关于项目名称在Visual Studio解决方案有时是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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