Search code examples
c#visual-studiovisual-studio-2019vsix

Get all startup projects in solution


As the title suggests I want to query all the Startup Projects set in a IVsSolution/IVsHierarchy, also I would love to achieve that without the DTE needed. Therefor DTE2.Solution.SolutionBuild.StartupProjects isn't really a suitable option for me. I have look into the MSDN, but didn't find quite what I needed. I came across the IVsSolutionManager with its get_StartupProject method. Unfortunately it will only return a single startup project. Is this even doable with using the DTE?


Solution

  • It appears, the EnvDTE.Solution.SolutionBuild.StartupProjects is the only way to do this. I did a walk through of the underlying VS IDE code base, and the startup projects are denoted by an internal flag on an internal C++ class tracking all the loaded projects. Unfortunately, neither that particular class or it's m_dwStartupOpt member are directly (or indirectly exposed.

    So your best/only option here is to use that StartupProjects property.

    Sincerely,