<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0"><channel><title>Anthony S. Kilhoffer</title><link>http://www.dotnetmafia.com/blogs/anthonykilhoffer/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AnthonySKilhoffer" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="anthonyskilhoffer" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>MS Surface Gotcha When Developing on x64 Platform</title><link>http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/2009/09/22/ms-surface-gotcha-when-developing-on-x64-platform.aspx</link><pubDate>Tue, 22 Sep 2009 21:36:00 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:975</guid><dc:creator>TonyKilhoffer</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://www.dotnetmafia.com/blogs/anthonykilhoffer/rsscomments.aspx?PostID=975</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/2009/09/22/ms-surface-gotcha-when-developing-on-x64-platform.aspx#comments</comments><description>&lt;p&gt;If you’re getting into MS Surface development and your development OS of choice is a x64 flavor of Windows Vista or Windows 7, there are several things to watch out for. Fortunately several people have already blogged about how to patch the SDK installer so you can install it on the x64 platform. Most of such blog posts, like &lt;a href="http://www.grumpydev.com/2009/05/17/surface-sdk-sp1-on-vista-and-win7-x64/" target="_blank"&gt;Steve Robbins’ post&lt;/a&gt; also detail how to fix several executables so they will not automatically attempt to run under the x64 CLR. Steve also goes on to show you how to configure the build settings of the SDK samples so they are forced to run under the x86 CLR. If you followed everything Steve laid out, you should be good. If, like me, you create a new solution and start adding Surface apps to it and forget to alter the build configuration, you’ll run into a very un-intuitive snag.&lt;/p&gt;
&lt;p&gt;If you don’t alter your build configuration for every Surface application you build as described in Steve’s blog post, your application will still compile, attach to the Surface Simulator, and even render your app as it should upon startup. But once it attempt’s to read input (a touch if you&amp;#39;re on the actual Surface, a mouse click if you’re running under the Simulator), a NotImplementedException is thrown from within the bowels of the Microsoft.Surface.Common framework. NotImplementedException? WTF!? Yeah, that’s what I thought, too. That sort of exception usually comes from incomplete APIs being released with stubbed out methods. Not sure why it happens when the Surface app has attempted to run under the x64 CLR, but it happens and it’s not immediately apparent that it was your mistake. At any rate, save yourself some time profiling and beating your head against the monitor and refer to Steve’s article. He shows you how to alter the build configuration and target the x86 platform explicitly. There is no harm in deploying your application under these conditions, since all Surface machines are currently 32-bit Vista machines at heart.&lt;/p&gt;
&lt;p&gt;Hope this saves someone some time. Happy Surfacing!&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=975" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/AnthonySKilhoffer/~4/3Nj3jZnWny0" height="1" width="1"/&gt;</description></item><item><title>ASP.Net MVC RTM Gotcha</title><link>http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/2009/03/19/asp-net-mvc-rtm-gotcha.aspx</link><pubDate>Fri, 20 Mar 2009 04:03:51 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:866</guid><dc:creator>TonyKilhoffer</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://www.dotnetmafia.com/blogs/anthonykilhoffer/rsscomments.aspx?PostID=866</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/2009/03/19/asp-net-mvc-rtm-gotcha.aspx#comments</comments><description>&lt;p&gt;If you’re like me, you get so excited to check out the RTM of any piece of software you’ve spent the past several months (or more) evaluating, that you dismiss the release notes. Well, this time it cost me. I went to create a new view in Visual Studio, used the new wizard that allows you to strongly type the view, compiled, ran, and ouch! I received the following error:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Parser Error Message: &lt;/b&gt;Could not load type &amp;#39;System.Web.Mvc.ViewPage&amp;lt;Reactor.Data.EventService&amp;gt;&amp;#39;.&lt;/p&gt;  &lt;p&gt;Got to love informative ASP.Net exception pages. After doing some digging, I found that in my rush to get the RTM up and running, I overlooked a piece of information that was vital. Apparently, there is an additional configuration block that needs to be added to the web.config file. I’ll save you some trouble of reading the release notes. Add the following attributes to the “pages” element of your web.config:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;pageParserFilterType=&amp;quot;System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&amp;quot; &lt;/p&gt;  &lt;p&gt;pageBaseType=&amp;quot;System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&amp;quot;&lt;/p&gt;  &lt;p&gt;userControlBaseType=&amp;quot;System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&amp;quot;&amp;gt; &lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=866" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/AnthonySKilhoffer/~4/hiOmqCJ7yCY" height="1" width="1"/&gt;</description></item><item><title>Post build event for an entire solution in Visual Studio</title><link>http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/2008/10/08/post-build-event-for-an-entire-solution-in-visual-studio.aspx</link><pubDate>Wed, 08 Oct 2008 21:00:00 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:734</guid><dc:creator>TonyKilhoffer</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://www.dotnetmafia.com/blogs/anthonykilhoffer/rsscomments.aspx?PostID=734</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/2008/10/08/post-build-event-for-an-entire-solution-in-visual-studio.aspx#comments</comments><description>&lt;p&gt;While creating the SDK for Reactor, I ran into a need to execute an outside utility after building a solution in Visual Studio. The utility packages up all project outputs in a solution and prepares it for registration with a Reactor server. Obviously, post build events at the project level were not sufficient, and there is no post build event configuration in the VS solution properties. Google didn&amp;#39;t produce any good results, either. So, I turned to my new favorite site for answers, &lt;a href="http://stackoverflow.com" target="_blank"&gt;stackoverflow.com&lt;/a&gt;. I asked the question, and in just minutes, I had &lt;a href="http://stackoverflow.com/questions/177188/is-there-a-way-to-run-an-outside-executable-after-a-solution-is-built-in-visual" target="_blank"&gt;the answer&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Basically, you have to handle the OnBuildDone event in a macro. I&amp;#39;m not a fan of VB syntax, but that&amp;#39;s what we&amp;#39;re limited to in the VS Macro Editor. Anyway, here is the code that was posted to the question on stackoverflow.com:&lt;/p&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;Public&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt; AfterBuild(&lt;span class="kwrd"&gt;ByVal&lt;/span&gt; scope &lt;span class="kwrd"&gt;As&lt;/span&gt; vsBuildScope, &lt;span class="kwrd"&gt;ByVal&lt;/span&gt; action &lt;span class="kwrd"&gt;As&lt;/span&gt; vsBuildAction) &lt;span class="kwrd"&gt;Handles&lt;/span&gt; BuildEvents.OnBuildDone    &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &lt;span class="kwrd"&gt;If&lt;/span&gt; scope = vsBuildScope.vsBuildScopeSolution &lt;span class="kwrd"&gt;Then&lt;/span&gt;        &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        System.Diagnostics.Process.Start(&lt;span class="str"&gt;&amp;quot;some file I want to run&amp;quot;&lt;/span&gt;)   &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;/div&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }


&lt;p&gt;It works as advertised and saved me from coming up with some crazy hack. I can&amp;#39;t take credit for this macro, and wish I knew who it was who answered the question on stackoverflow, but all I know is his/her username is &lt;a href="http://stackoverflow.com/users/5486/kyralessa"&gt;Kyralessa&lt;/a&gt;. Thanks, Kyralessa!&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=734" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/AnthonySKilhoffer/~4/FFntmYtaSYM" height="1" width="1"/&gt;</description><category domain="http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/tags/Macros/default.aspx">Macros</category></item><item><title>Using the System.AddIn namespace to facilitate extensibility, Part Two</title><link>http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/2008/10/08/using-the-system-addin-namespace-to-facilitate-extensibility-part-two.aspx</link><pubDate>Wed, 08 Oct 2008 16:45:00 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:733</guid><dc:creator>TonyKilhoffer</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://www.dotnetmafia.com/blogs/anthonykilhoffer/rsscomments.aspx?PostID=733</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/2008/10/08/using-the-system-addin-namespace-to-facilitate-extensibility-part-two.aspx#comments</comments><description>&lt;p&gt;Part two of this multi-part series on the System.AddIn model focuses on the add-in pipeline. If you haven&amp;#39;t read &lt;a href="http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/2008/10/06/using-the-system-addin-namespace-to-facilitate-extensibility.aspx"&gt;Part One&lt;/a&gt;, or you&amp;#39;re not familiar with the System.AddIn model, you should read it before continuing. &lt;/p&gt; &lt;h4&gt;Pipeline Overview&lt;/h4&gt; &lt;p&gt;The add-in pipeline is a set of logical segments that the host and add in use to communicate with one another. I showed this diagram found on MSDN in &lt;a href="http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/2008/10/06/using-the-system-addin-namespace-to-facilitate-extensibility.aspx" target="_blank"&gt;Part One&lt;/a&gt; and here it is again. It&amp;#39;s a good depiction of the pipeline and how each segment relates to another.&lt;/p&gt; &lt;p&gt;&lt;img src="http://i.msdn.microsoft.com/Bb384201.AddIn1(en-us,VS.90).png" alt="" /&gt; &lt;/p&gt; &lt;p&gt;I&amp;#39;ll describe each segment starting from the left (the host). Note that each segment is usually in its own .Net project. There are some optional exceptions, as I will detail later in this post, but for now just assume they are each a separate entity. Some types in the segments are required to be decorated with attributes found in the System.AddIn namespace. Those types are identified with the appropriate attribute type in square brackets ([example]) in the heading of each description.&lt;/p&gt; &lt;h5&gt;Host&lt;/h5&gt; &lt;p&gt;The host is the application that utilizes the add in to extend it&amp;#39;s own functionality. It can be a Windows application, service, or another add in. It&amp;#39;s responsible for discovering, activating, and managing the supported add ins.&lt;/p&gt; &lt;h5&gt;Host view of add-ins&lt;/h5&gt; &lt;p&gt;Although most of the MSDN documentation describes the host and add-in views as being abstract base classes, they can also be interfaces. Personally, I prefer the interface option, but your needs and preferences will likely vary. The host view represents the signature the host uses to communicate with the add-in.&lt;/p&gt; &lt;h5&gt;Host side adapter [System.AddIn.Pipeline.HostAdapterAttribute]&lt;/h5&gt; &lt;p&gt;For you design pattern enthusiasts, this is a classic example of the adapter pattern. It&amp;#39;s purpose is to convert the types flowing from the host view to the contract segment. It contains no logic other than that necessary to copy a member from the view to the contract.&lt;/p&gt; &lt;h5&gt;Contract [System.AddIn.Pipeline.AddInContractAttribute]&lt;/h5&gt; &lt;p&gt;As it&amp;#39;s name implies, this segment is the contract defined and agreed upon between the host and add-in. It must be an interface and it must implement the IContract interface itself. &lt;/p&gt; &lt;h5&gt;Add-In side adapter [System.AddIn.Pipeline.AddInAdapterAttribute]&lt;/h5&gt; &lt;p&gt;Just as it&amp;#39;s host side counterpart converts the types flowing to the add in from its view, the add-in side adapter converts types from it&amp;#39;s view to the contract.&lt;/p&gt; &lt;h5&gt;Add-In view [System.AddIn.Pipeline.AddInBaseAttribute]&lt;/h5&gt; &lt;p&gt;Again, just a mirror image of the host side view. It can be either an interface or abstract class, and it represents the signature the add-in uses to communicate with the host.&lt;/p&gt; &lt;h5&gt;Add-In [System.AddIn.Pipeline.AddInAttribute]&lt;/h5&gt; &lt;p&gt;Does this segment really need to be defined? Isn&amp;#39;t the add-in the whole reason you&amp;#39;re reading this?&lt;/p&gt; &lt;h4&gt;Pipeline Development Considerations&lt;/h4&gt; &lt;p&gt;You&amp;#39;re probably thinking (all two of my loyal readers) of what a pain in the ass pipeline development must be. If you think of all the types you want to pass between the host and the add-in and consider each segment in the pipeline, you&amp;#39;re looking at a lot of projects and a lot of plumbing. While that&amp;#39;s true, there is some hope. Microsoft graced us with a Visual Studio add-in called the &lt;a href="http://www.codeplex.com/clraddins/Wiki/View.aspx?title=Pipeline%20Builder&amp;amp;referringTitle=Home" target="_blank"&gt;Pipeline Builder&lt;/a&gt;. You simply build the contract, and let the tool generate the additional projects for you. Huge time saver. When I started using the System.AddIn model, I didn&amp;#39;t know about the tool. I wrote all the plumbing by hand and it was really daunting. Once I stumbled across the tool, however, it eased my pain considerably. I just wish they would have linked to the tool from the MSDN documentation so I would have found it sooner.&lt;/p&gt; &lt;p&gt;If you encounter a situation where you need to pass types that are not serializable between host and add-in, you&amp;#39;ll need to take some additional steps. Types like these and collections of non-serializable types, need to have a full pipeline defined for it. You&amp;#39;ll have to create a contract, views for both sides, and adapters. Again, with the help of the Pipeline Builder, it won&amp;#39;t be too bad.&lt;/p&gt; &lt;h5&gt;References&lt;/h5&gt; &lt;p&gt;The following segments need the following references:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Contract: System.AddIn.dll, System.AddIn.Contract.dll&lt;/li&gt; &lt;li&gt;Add-in view: System.AddIn.dll&lt;/li&gt; &lt;li&gt;Add-in side adapter: System.AddIn.dll, System.AddIn.Contract.dll, Add-in view segment, Contract segment&lt;/li&gt; &lt;li&gt;Host side adapter: System.AddIn.dll, System.AddIn.Contract.dll, Host view segment, Contract segment&lt;/li&gt; &lt;li&gt;Host: System.AddIn.dll, Host view segment&lt;/li&gt; &lt;li&gt;Add-In: System.AddIn.dll, Add-in view segment&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;A note about the pipeline, and a very important one, is that when you set up references between the various segments, set the reference&amp;#39;s &amp;quot;Copy Local&amp;quot; property to &amp;#39;false&amp;#39;. If you don&amp;#39;t, you&amp;#39;re going to run into conflicts and it may take a while to figure out what went wrong. Such conflicts are not immediately obvious.&lt;/p&gt; &lt;h5&gt;Directory structure&lt;/h5&gt; &lt;p&gt;Your host will have to have a very specific directory structure defined for the add-ins. This very rigid structure is necessary for the framework to discover the add-ins and the various pipeline segment assemblies. The following diagram from MSDN shows what the structure should look like.&lt;/p&gt; &lt;p&gt;&lt;img src="http://i.msdn.microsoft.com/Bb384240.AddIn_Pipeline(en-us,VS.90).png" alt="" /&gt; &lt;/p&gt; &lt;p&gt;Earlier in the post, I mentioned some exceptions to the one project per segment rule. The host views of the add-in and the add-in views of the host can be combined into one assembly. The adapters can also be combined into one assembly, although this is only possible if you also combine the views into their own assembly. If you combine any of the mentioned types into their own assemblies, you have to deploy the assemblies to both sides of the pipeline. I have just been creating every segment in its own assembly so I don&amp;#39;t have to remember these rules. Troubleshooting pipeline configuration can be tricky, so I try to keep it as simple as possible.&lt;/p&gt; &lt;h4&gt;Closing&lt;/h4&gt; &lt;p&gt;In the next part of this series, I&amp;#39;ll demonstrate how to build the pipeline and alternatively, how to generate it automatically from a contract.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=733" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/AnthonySKilhoffer/~4/L9U7SWUKPVo" height="1" width="1"/&gt;</description><category domain="http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/tags/System.AddIn/default.aspx">System.AddIn</category></item><item><title>Using the System.AddIn namespace to facilitate extensibility.</title><link>http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/2008/10/06/using-the-system-addin-namespace-to-facilitate-extensibility.aspx</link><pubDate>Mon, 06 Oct 2008 20:54:00 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:724</guid><dc:creator>TonyKilhoffer</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://www.dotnetmafia.com/blogs/anthonykilhoffer/rsscomments.aspx?PostID=724</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/2008/10/06/using-the-system-addin-namespace-to-facilitate-extensibility.aspx#comments</comments><description>&lt;p&gt;If you&amp;#39;ve ever written a plug in framework for an application, you can appreciate how much work goes into managing the framework and the add ins it supports. The purpose of this post is to introduce you to the facilities contained in the .Net framework that make add in support much, much easier. First, let me identify some core concepts surrounding add in architectures. I&amp;#39;ll try to keep these concepts platform and language neutral, since the need for application extensibility transcends platforms. Then, I&amp;#39;ll show you how the classes in the System.AddIn namespace strive to meet them.  &lt;p&gt;Note that when .Net 3.5 was in beta and the news of this add in framework was first released, it was referred to as the Managed AddIn Framework (MAF). Since it&amp;#39;s release, however, the CLR team has been referring to it as simply the &amp;quot;System.AddIn model&amp;quot;. &lt;h4&gt;&lt;strong&gt;General Add In Core Concepts&lt;/strong&gt;&lt;/h4&gt; &lt;h5&gt;&lt;strong&gt;Players&lt;/strong&gt;&lt;/h5&gt; &lt;p&gt;Add in models require two basic entities: the add in &lt;em&gt;host&lt;/em&gt; and the &lt;em&gt;add in&lt;/em&gt; &lt;em&gt;itself&lt;/em&gt;. While both players are rather obvious, it&amp;#39;s important to note that the host can take the form of an application, service, operating system, or even another add in.  &lt;p&gt;The host is responsible for identifying supported add ins, activating them, and managing their lifetime. The add in itself is responsible for supplying additional functionality to it&amp;#39;s host.  &lt;h5&gt;&lt;strong&gt;Discovery &lt;/strong&gt;&lt;/h5&gt; &lt;p&gt;Discovering available add ins is the first step to being able to use them. In a fully functional architecture, your host must be able to discover add ins and report on them without activating them. This allows you to selectively activate and deactivate add ins as the needs dictate. &lt;h5&gt;&lt;strong&gt;Activation&lt;/strong&gt;&lt;/h5&gt; &lt;p&gt;In order to allow the add in to perform it&amp;#39;s intended purpose, it must be activated. Activation includes creating an instance of the add in and turning over control to it. Your specific needs will dictate what level of isolation is required for your application. &lt;h5&gt;&lt;strong&gt;Isolation&lt;/strong&gt;&lt;/h5&gt; &lt;p&gt;It would be a grave mistake to allow a hosted add in to affect the stability of the host, so isolation is, in my opinion, the most important concept involved in extensibility. It is vital that an add in be isolated from the rest of the application and only allowed to interact in the way the host designer intended.&amp;nbsp; &lt;p&gt;The ultimate in isolation is running the add in out of process. That is, in it&amp;#39;s own process. Due to performance restrictions, however, some architects prefer they are isolated in logical sandboxes or sub processes. &lt;h5&gt;&lt;strong&gt;Lifetime Management&lt;/strong&gt;&lt;/h5&gt; &lt;p&gt;In most modern languages and platforms, the lifetime of objects is handled by the underlying runtime. This is a great benefit to developers, not having to worry about memory management. But in the case of add ins that are isolated from the hosting process, standard lifetime management isn&amp;#39;t enough. Referential integrity must be maintained across process boundaries to ensure the references are not prematurely garbage collected. &lt;h4&gt;&lt;strong&gt;System.AddIn Namespace&lt;/strong&gt;&lt;/h4&gt; &lt;p&gt;Now that we&amp;#39;ve identified some key areas of interest when considering add in architectures, let&amp;#39;s see how the System.AddIn namespace strives to resolve them. First, I&amp;#39;ll talk just a bit about about a few key classes you&amp;#39;ll be using and the concept of the add in pipeline. &lt;p&gt;System.AddIn.Hosting.AddInStore is a static class that contains methods related to the physical storage and retrieval of add ins. &lt;p&gt;System.AddIn.Hosting.AddInToken is a class that represents an add in and its associated pipeline segments that can be activated. &lt;p&gt;The add in pipeline is a term used to refer to the pipeline of communication between the add in and its host. While creating and understanding the various segments can become complex, it&amp;#39;s important to note that there is a tool called the &lt;a target="_blank" href="http://www.codeplex.com/clraddins/Wiki/View.aspx?title=Pipeline%20Builder&amp;amp;referringTitle=Home"&gt;Pipeline Builder&lt;/a&gt; that be used to generate some portions of the pipeline, making development and maintenance a bit easier.  &lt;p&gt;The following diagram is a popular one to show the various pipeline segments and their relations.  &lt;p&gt;&lt;img src="http://i.msdn.microsoft.com/Bb384201.AddIn1(en-us,VS.90).png" alt="" /&gt;  &lt;p&gt;&amp;nbsp; &lt;p&gt;I think the best explanation of each pipeline segment was best done in the MSDN documentation, which can be found &lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/bb384201.aspx"&gt;here&lt;/a&gt;.  &lt;h5&gt;&lt;strong&gt;Discovery&lt;/strong&gt;&lt;/h5&gt; &lt;p&gt;As mentioned above, the AddInStore class contains methods that are used to manage the storage and retrieval of add ins. It discovers newly added add ins and maintains a cache summary of the available add ins. In short, discovery is nicely abstracted by the AddInStore methods, as long as you provide the correct base add in directory to the Update method. &lt;h5&gt;&lt;strong&gt;Activation&lt;/strong&gt;&lt;/h5&gt; &lt;p&gt;Just as discovery was abstracted away for us, so is activation. The AddInTokens we&amp;#39;ve already discovered contain a generic method aptly named Activate that takes care of that for us. It&amp;#39;s at this point that we specify our level of isolation and security by calling the proper overloaded version of said method. &lt;h5&gt;&lt;strong&gt;Isolation&lt;/strong&gt;&lt;/h5&gt; &lt;p&gt;With the System.AddIn model, you have a few isolation options. You can activate an add in in an existing application domain, a new application domain, or an external process. As I mentioned in the core concepts section, your specific needs will dictate which level of isolation you&amp;#39;ll choose.  &lt;p&gt;If you&amp;#39;re not familiar with what an application domain is, shame on you. It&amp;#39;s a fundamental concept of the .Net framework and you should &lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.appdomain.aspx"&gt;become familiar with it&lt;/a&gt; immediately. &lt;p&gt;As I mentioned under Activation in this section, you simply choose the proper overload of the AddInToken.Activate method that suits your needs. The framework takes care of the rest for you. This is one of the largest areas of benefit the System.AddIn model provides. Previous to this model, you had to manually spawn appdomains and/or processes and manage them yourself. It was a very cumbersome and sometimes tricky process. &lt;h5&gt;&lt;strong&gt;Lifetime Management&lt;/strong&gt;&lt;/h5&gt; &lt;p&gt;The .Net garbage collector is not equipped to manage the lifetime of objects that are used across isolation boundaries. The logic involved in doing this is once again abstracted from us. The responsible classes use a combination of reference counting and remoting services to accomplish this. You have to do nothing to maintain the reference. Should you wish to terminate the reference and the add in instance at the add in side, there is a class called the AddInController that can help. It contains a Shutdown method that will free up references and resources for you. &lt;h4&gt;&lt;strong&gt;In Closing&lt;/strong&gt;&lt;/h4&gt; &lt;p&gt;The System.AddIn model has helped me overcome many extensibility issues and it made it a pleasure doing so. I encourage anyone thinking of designing such an application to spend some time getting to know the model. It will save you a lot of time and a lot of heartache, I&amp;#39;m sure of it. If anyone runs into any limitations they are not able to overcome, I would like to hear about it. So far, it&amp;#39;s done everything I&amp;#39;ve needed it to without a hitch. &lt;p&gt;The best documentation I&amp;#39;ve found is on MSDN and &lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/bb384241.aspx"&gt;this location&lt;/a&gt; is a good starting place.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=724" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/AnthonySKilhoffer/~4/l_-GZecc_w4" height="1" width="1"/&gt;</description><category domain="http://www.dotnetmafia.com/blogs/anthonykilhoffer/archive/tags/System.AddIn/default.aspx">System.AddIn</category></item></channel></rss>

