Note that there are some explanatory texts on larger screens.

plurals
  1. POVS2010 DTE Addin: project inside solution folder is not "Project"
    text
    copied!<p>I have a small vs addin which looks for projects inside a solution and does a few stuff with it. I collect the projects like this:</p> <pre><code>Application.DTE.Solution.Projects.OfType&lt;Project&gt;(); </code></pre> <p>However, as soon as I introduced a solution folder and placed a project inside it, suddenly that project was nowhere to be found. So, I've tried</p> <pre><code> private IEnumerable&lt;Project&gt; getProjectsRecursive(IEnumerable&lt;Project&gt; iEnumerable) { foreach (var item in iEnumerable) { yield return item; foreach (var child in getProjectsRecursive(item.ProjectItems.OfType&lt;Project&gt;())) { yield return child; } } } public IEnumerable&lt;Project&gt; EveryProject { get { return getProjectsRecursive(Application.DTE.Solution.Projects.OfType&lt;Project&gt;()); } } </code></pre> <p>still the project is not there. So I've checked manually, calling <code>item is Project</code> on a</p> <ul> <li>project directly inside the solution is <strong>TRUE</strong></li> <li>solution folder directly inside the solution is <strong>TRUE</strong> (small wtf)</li> <li>project inside a solution folder (I've found it in <code>folder.ProjectItems</code>) is <strong>FALSE</strong> !!!!! (and of course explicit casting throws an error)</li> </ul> <p><strong>What the hell?</strong> Without casting it to <code>Project</code>, I cannot call <code>FullName</code>, <code>Properties()</code> and many other things on it, even if I cast to <em>dynamic</em>. Please help!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload