I have a small vs addin that searches for projects inside a solution and does a few things with it. I collect projects as follows:
Application.DTE.Solution.Projects.OfType<Project>();
However, as soon as I presented the solutions folder and placed the project inside it, suddenly this project was not found anywhere. So I tried
private IEnumerable<Project> getProjectsRecursive(IEnumerable<Project> iEnumerable) { foreach (var item in iEnumerable) { yield return item; foreach (var child in getProjectsRecursive(item.ProjectItems.OfType<Project>())) { yield return child; } } } public IEnumerable<Project> EveryProject { get { return getProjectsRecursive(Application.DTE.Solution.Projects.OfType<Project>()); } }
still no project. So I checked manually by calling item is Project on
- project directly inside the solution TRUE Solutions folder
- directly inside the TRUE solution (small wtf)
- inside the solutions folder (I found it in
folder.ProjectItems ) FALSE !!!!! (and, of course, explicit casting causes an error)
What the heck? Without dropping it on Project , I cannot call FullName , Properties() and much more on it, even if I move on to dynamic. Please, help!
source share