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:
C#
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
Last update:
2023-03-05
Created: 2021-04-29
Created: 2021-04-29