How can I determine if I am running an application from the Visual Studio IDE?
See the question and my original answer on StackOverflowIf you need to determine the "parent process" of a given process, here is a link on SO: How to get parent process in .NET in managed way
That being said, what I would do instead is split your program in two: one class library (a DLL, that will contain all the real meat of what your program does) and one EXE that references this class library. This way you can create a 3rd project as a VS Addin that will also reference this class library, but will implicitely be aware that it's running from VS.