In VB6, I use this little nugget to tell whether or not I am running inside the IDE...
VB Code:
  1. Private Function InIDE() As Boolean
  2. On Error GoTo ReturnTrue
  3.  
  4.     Debug.Print (1 / 0)
  5.     InIDE = False
  6.     Exit Function
  7.    
  8. ReturnTrue:
  9.     InIDE = True
  10. End Function

Is there a similar way to do it in the .NET IDE? (In any language really)