What you are mostly looking for is a solution using the Visual Studio SDK.
You can create your own add-ons by implementing the IDTExtensibility interface .
In the OnConnection function, you can subscribe to various events. Using the (DTE2)application , you can access from several things from VS.
You need to subscribe to some of the events that can be obtained from the Events property.
You will need to find out which events are best for your decision. But DebuggerEvents would seem like a good place to start.
This requires some research before you can use it. Most likely, there will be simpler solutions.
As a simple example for OnConnection :
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { var applicationObject = (DTE2)application; var events = _applicationObject.Events; var buildEvents = (BuildEvents)events.BuildEvents; buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(OnBuildBegin); }
This works when the build starts. The documentation available is small, so you will need a trial version and errors before you find what you need.
source share