Skip to content

Visual Studio Debugger RPC Extension#

Of course after writing all this, it soon became obvious that there were better ways. Here’s the C# equivalent:

using EnvDTE;
namespace AttachDebugger
{
  class Program
  {
    static void Main(string[] args)
    {
      try
      {
        DTE dte = (DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.10.0");
        dte.ExecuteCommand("Macros.StarVSMacros.Debug.AttachToGame");
      }
      catch (System.Exception e)
      {
        System.Windows.Forms.MessageBox.Show("EXCEPTION - Debugger not available: " + e.Message);
      }
    }
  }
}

This is the version I ended up using. All it needs is a reference to EnvDTE added to your C# project to compile. Some references: - Visual Studio extensibility - How to: Add References to the EnvDTE and EnvDTE80 Namespaces - How to: Get References to the DTE and DTE2 Objects - Visual Studio Automation Reference - VBScript Primer - VBScript Error Handling

From https://github.com/dwilliamson/b/blob/623a4882561c0893e01488730896c6660794e257/Posts/2012-02-07-11-37-23.txt


Last update: December 26, 2019