Well, it's not that difficult if you can access the EnvDTE80.DTE2 representing your instance of Visual Studio. In fact, if dte is your instance of DTE2, it is simple as:
foreach (Project prj in dte.Solution.Projects) { MessageBox.Show(Path.GetDirectoryName(prj.FullName)); MessageBox.Show(prj.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value.ToString()); }
Getting a DTE2 object is easy if you are writing an add-in, since this is the first parameter passed to OnConnection (the add-in project wizard automatically writes code that puts it in the _applicationObject variable in the Connect class).
If you have only a component, you can get the Site property, which implements ISite, which comes from IServiceProvider, and ask him to get DTE2. If compo is your component:
dte = (DTE2)compo.Site.GetService(typeof(DTE2));
source share