Automation Add-Ins [Jesse Kaplan]

First off I’d like to apologize for the long pause between posts. We’ve been working heads down on some pretty exciting add-in stuff that we can’t announce just yet and haven’t had as much time as we’d like to spend on this blog. We’re wrapping that work up now though so you should see the stream of posts picking up.

To start us off I’d like to post a quick sample to responds to a lot of questions I’ve been getting.

All of our samples so far have been pretty simplistic with very shallow object models that are focused on the add-ins providing a service to the host. The two most common questions I recieve about our model is how it applies when the host is actually providing a service to the add-in (think of an automation scenario) and how to express events in the pipeline. Attached is a sample that shows a complete pipeline demonstrating some typical patterns in a host automation scenario. It doesn’t include an actual host or add-in but as you’ll see when you look at the two views that the programming experience for both would still be smooth even with the more complex object model.


Note: The attached samples was built for a pre-RTM version of .NetFX 3.5 and will not work on the RTM build. For an updated sample please see our codeplex site:

Additionally there is a sample available demonstrating add-ins exposing events to hosts and includes both the host and the add-in so you can easily step through it and follow the code. It is available here:

Comments (12)

  1. Tom Guinther says:

    I think the stuff you guys are doing is great and I am looking forward to using it. Having developed an advanced plug-in architecture that seems similar to what you guys are doing (we are solving the same problems), I am disappointed that it is a 4GB+ download (and a host of other Orcas headaches as well) when it could clearly be implemented on the 2.0 framework. Eventually this wont be an issue and everyone will have .NET 3.5 etc.

    Why not provide the same basic functionality for 2.0/3.0 in a 100kb download?


  2. Garry Trinder says:

    I’m glad you’re interested in what we’re working on and all I can tell you about the deployment issues is to just hang in there. As we get into the beta phase and onwards towards release we (not the add-in team specifically but the .net framework team in general) will be working to make deployment of our beta and final bits easier.

    In the end deployment of the 3.5 framework should be relatively easy as it will end up being just a bunch of new managed assemblies that depend on the latest SP of 2.0/3.0.

  3. You’ve been kicked (a good thing) – Trackback from

  4. noslenytram says:

    In your sample you are using System.AddIn.Pipeline.ContractHandle which does not appear in C:WINDOWSMicrosoft.NETFrameworkv3.5.20209.

    It looks like you had some GAC references to C:WINDOWSassemblyGAC_MSILSystem.AddIn3.5.0.0__b77a5c561934e089System.AddIn.dll – but I don’t think that should matter here?  I repointed mine to the above path.

  5. Garry Trinder says:

    I’m sorry about ContractHandle showing up in this sample. This is the peril of building samples on a dev box. Post-beta 1 we renamed LifetimeTokenHandle to ContractHandle, replacing ContractHandle with LifetimeTokenHandle in the code should fix everything up.

  6. Boris Yurovsky says:

    This is great! This new Add-In architecture can help my company to solve the problems we’re facing developing our framework. I was wondering if there is a way for a Add-In to pass UI objects through the pipeline to the host side. ExtensibleCalculator sample shows how to do it with WPF control using INativeContractHandle interface. How about Window.Forms controls? Is it the same interface to be used for it as well?


  7. Marlun says:

    I’m also wondering about the same thing as Boris Yurovsky.

  8. Claus Brod says:

    Hi Jesse,

    thanks for the sample code! Do you happen to have matching host/addin code for this as well? I think being able to step through calls between host and addin would make it much easier for me to understand what’s going on.

    Also, is there a sample out there which demonstrates a simple host object model without events? Maybe that would make it easier to grasp the basic concepts, too.


  9. Zum System.AddIn Namespace habe ich bereits das ein oder andere geschrieben. Das Beispiel das ich benutze

  10. Zq3 says:

    Hi, I have a question for you regarding the Automation Add-Ins sample (

    I implemented a host app and simple add-in to see the sample working, but I don’t understand something.

    I subscribe to the HostObject event (DocumentLoad) into the HostApplication, and then when in the add-in I receive the HostObject (in the Initialize method) the event is null, it’s that right?

    I was thinking that in the add-in I can raise the HostObject event and the host application will be called. Is that the normal behavior or the normal behavior is to subscribe also to the HostObject event in the add-in and then when in the host the event is raised this will call the add-in event?


  11. In this post I will be showing sample code (also found on our CodePlex site ) as well as an execution