title: How do I attach Visual Studio to a process that is not started yet?
body: <p>I have .NET program that can't be run from Visual Studio for some reasons (Excel file created from an Excel 2010 template project) for which I need to debug startup events.</p>
  
  <p>If I want to debug events that comes after program initialisation there is no problem. I run the program from the explorer, attach the process to Visual Studio and add some breakpoints in the code. But here, I need to put breakpoints on the startup events. I need to be able to attach processes to Visual Studio, not depending on a PID, but on a specific process name or whatever other solution that would work.</p>
  
  <p>Of course adding a <code>Thread.Sleep(1000)</code> in my startup events to give me some time to attach the process in Visual Studio is out of the question!</p>