Sunday, May 27, 2007

Managed Add-Ins for .NET 3.5

A new architecture for managed add-ins is introduced with .NET 3.5. The new functionality shipped in System.AddIn addresses common tasks such as discovery, activation, isolation and sandboxing. Add-in version problems are also addressed by allowing developers to isolate version adapters into separate assemblies.

Add-in discovery and activation is simplified with two new classes: AddInStore and AddInToken. AddInStore helps you to find add-ins based on type and location while AddInToken allows you to activate. Here's some sample code:

IList<AddInToken> tokens = AddInStore.FindAddIns(typeof(AddInType), addinPath);
foreach (AddInToken token in tokens)
{
Token.Activate<AddInType>(AddInSecurityLevel.Internet);
}

The framework SDK also includes a tool called AddInUtil.exe that makes it easy to manipulate the AddInStore.

A variety of isolation & sandboxing modes are supported upon activation. Isolation and pooling allow you load add-ins in-appDomain, cross-appDomain and cross-process. You can also conveniently apply standard and custom permission sets to the sandbox.

Jesse Kaplan has a recently written an article on managed add-ins in the Architecture Journal and is a regular contributor to the CLR Add-In Team Blog.

Technorati Tags: ,

No comments:

Post a Comment