Visual Studio : executing clean up code when debugging stops

You can use the DTE (VisualStudio Automation Model) to write a macro that will be invoked when a stop debug happens, below is a snippet of the idea. Private Sub DebuggerEvents_OnEnterBreakMode( ByVal Reason As EnvDTE.dbgEventReason, ByRef ExecutionAction As EnvDTE.dbgExecutionAction) Handles DebuggerEvents.OnEnterBreakMode If (Reason = dbgEventReason.dbgEventReasonStopDebugging) Then // DO YOUR CLEAN UP CODE HERE End If … Read more

How to perform .Onkey Event in an Excel Add-In created with Visual Studio 2010?

“I would like to run some code when users presses a combination of keys.” Its tricky and to do it without any external dependencies resort to Keyboard hooking to achieve it with a VSTO Excel Add-in: Imports System Imports System.Runtime.CompilerServices Imports System.Runtime.InteropServices Imports System.Windows.Forms Friend Class KeyboardHooking ‘ Methods <DllImport(“user32.dll”, CharSet:=CharSet.Auto, SetLastError:=True)> _ Private Shared … Read more

How can I invoke my MSBuild Target when msbuild.exe starts and when it ends

To execute a solution-wide Before and After targets, you would create two MSBuild project files named “after.<SolutionName>.sln.targets” and “before.<SolutionName>.sln.targets” in the same folder as your solution. To do this on all solutions, you would drop your custom solution-level after targets files into the path $(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\SolutionFile\ImportBefore\ or $(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\SolutionFile\ImportAfter. When those solutions are built, it will import … Read more