views:

477

answers:

2

Does anyone know the equivalent for doing this in Visual Studio 2008(EnvDTE90) and Visual Studio 2008 SP1(EnvDTE90a)?

    //this is code for Visual Studio 2005, works great
    EnvDTE80.DTE2 dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.
    GetActiveObject("VisualStudio.DTE.8.0");

    foreach (EnvDTE80.Breakpoint2 bp in dte2.Debugger.Breakpoints)
    {
         //do some things
    }

I have done normal google searches and found various things, but none of them worked.

EnvDTE90.Debugger3 seems to only work if actively debugging. I want to access breakpoints at anytime?

NOTE: Please don't send links to existing code examples that SHOULD work. I have tried all that I can find.

+2  A: 

The VS2005 code (EnvDTE80) should work fine with VS2008 too. EnvDTE90 just adds some new functionality but EnvDTE80 and EnvDTE are still needed for the basics.

KristoferA - Huagati.com
My same VS 2005 code will not run in VS 2008 that you see in the question.
rick schott
+1 partially correct
rick schott
A: 

I finally got some code working. KristoferA's answer is partially correct in that the same API can be used, but the code would not work verbatim. This is how I got it to work:

EnvDTE80.DTE2 dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.
GetActiveObject("VisualStudio.DTE.9.0");

foreach (EnvDTE80.Breakpoint2 bp in dte2.Debugger.Breakpoints)
{
     //do some things
}
rick schott