I wanted to pass on a story that I read in my RSS reader that John blogged about a couple weeks ago:

I got fed up with attaching a debugger to addins in OneNote. The typical process (as suggested by Dan Escapa) is to have your addin open a dialog when it starts, then attach to the running process while the dialog is onscreen. That got annoying rather quickly and I started to look for an easier way to attach to a running powertoy. It turns out System.Diagnostics has just the method I need.

The easier way to attach a debugger is to call


This will automatically attach your default debugger to the running process. If you want, you can surround that line with DEBUG conditional statements like this:




Now if you are using VS to create a debug build, the debugger will get attached. Ship builds will not include these lines.

After getting the debugger attached, I was still forced to uninstall the previous build of my addin and run the install to get the new bits into place. The last tip is making it easier to spoof the install for new builds so you don't have to spend time uninstalling, reinstalling or even building the setup project each time.

Build and install the debug app once.

Go back into Visual Studio and redirect the debug output to the folder in which you installed your app.

(optional: you can turn off building the setup project each time now)

Now when you rebuild or recompile, the old dll gets overwritten by the new, and you do not have to uninstall/reinstall for each new compile. This works great since the GUID doesn't change once the project is created.

When you are done, be sure to rebuild the setup project.

These are just a couple of tweaks I discovered recently. Nothing earth shattering - just simple time savers.

Read the whole thing over on John's excellent blog: An easier way to troubleshoot addins for OneNote.  Nice work John!