With VsShellUtilities
API, I can get the project for a particular file with the GetProject
method. How can I get the startup project?
Asked
Active
Viewed 631 times
0

Colonel Panic
- 132,665
- 89
- 401
- 465
1 Answers
2
To get the startup project(s) of a solution you can use:
The IVsSolutionBuildManager.get_StartupProject method, but only if you know in advance that your solution has only a single startup project.
The automation model (EnvDTE). You can get an instance of EnvDTE.DTE (HOWTO: Get the EnvDTE.DTE instance from a package) and then use DTE.Solution.SolutionBuild.StartupProjects.

Carlos Quintero
- 4,300
- 1
- 11
- 18
-
Thanks. Can I do the first from C#? – Colonel Panic Sep 25 '15 at 10:43
-
Yes, why not? Use IVsSolutionBuildManager solutionBuildManager = base.GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager; – Carlos Quintero Sep 25 '15 at 11:29