Visual Studio 2008 and 2008 SP1 Addin: using EnvDTE90 and EnvDTE90a
-
21-08-2019 - |
Question
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.
Solution 2
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
}
OTHER TIPS
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.