I'm trying to get a list of all projects within a specified VS2008 solution. (this is a stand-alone console app, it is not a Visual Studio add-in)
My code works with VS2005 solutions, but I get all sorts of ugly COM errors trying to use the VS2008 object.
What I mean is: This:
Type _visualStudioType = Type.GetTypeFromProgID("VisualStudio.DTE.8.0");
DTE _dte = Activator.CreateInstance(_visualStudioType) as DTE;
works and this:
Type _visualStudioType = Type.GetTypeFromProgID("VisualStudio.DTE.9.0");
DTE _dte = Activator.CreateInstance(_visualStudioType) as DTE;
doesn't (currently throws COM error 8001010a)
I have both relevant classes registered in the registry, and all appropriate assemblies are referenced.
Edit: I'll go with basic parsing of the .sln file, even if I have to do a bit of rewriting, as text manipulation is bound to work without all the nasty interop stuff. However, I can't seem to find a description of the .sln format, any resources?