2

I'm making Visual Studio package, and I need to know opened solution name and configuration. How can I get this information ?

halfer
  • 19,824
  • 17
  • 99
  • 186
zdebyman
  • 550
  • 1
  • 4
  • 22

1 Answers1

2

If you have a reference to EnvDTE, you can use dte.Solution and dte.Solution.SolutionBuild.ActiveConfiguration.

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
  • thanks for answer, but i get crash with exception(Retrieving the COM class factory for component with CLSID), after googling i found that it should solution be in x86. Is it so ? – zdebyman Oct 26 '12 at 08:28
  • A VS Package must be compiled as x86. Visual Studio is 32-bit only. – Simon Mourier Oct 26 '12 at 08:34
  • And for those looking on how to get a reference to the `DTE`, call the `GetService()` method as such: `DTE dte = (DTE)GetService(typeof(DTE));`. – Dave Clemmer Jan 22 '13 at 23:32