Project Description
This Codeplex site will feature demos, samples, and helper libraries related to the selection and activation of the CLR.

With .Net Framework 4 and VS 2010 the new ability to load multiple versions of the runtime has changed the way a version is chosen for any particular piece of managed code and gives developers much more control over the runtime their code will end up running against. For a detailed introduction to this new functionality you can see this MSDN magazine article. This CodePlex project will focus on the various ways to start up the runtime and how to influence these choices using the new runtime activation APIs introduced in .Net Framework 4. Our first two projects will include a helper library to ease migration from the old to the new APIs and a managed wrapper of our new native APIS.

Current Projects
Legacy Activation APIs Shim
This project makes it easier to migrate hosts that used the legacy hosting APIs to CLR v4. The LegacyActivationShim.h file allows simple migration from .NET Runtime v2 Host Activation APIs to the .NET Runtime v4 Host Activation APIs through simple shim functions. To use, just include this header file after the header file that declares the deprecated APIs you are using, and append the "LegacyActivationShim::" namespace in front of all deprecated API calls. It also includes the options to fall back on the legacy APIs for cases where v4 is not installed on the machine.

Managed Wrappers for new shim APIs
The managed wrappers make it possible to utilize the new v4 runtime activation APIs from managed code. These APIs allow you to enumerate installed runtimes, probe processes for loaded runtimes, inspect runtime information, and use runtime activation policy. This would allow a managed application to provide an in-proc SxS-aware extensibility model, or merely react to its environment in an in-proc SxS safe way.

The wrappers are made up of 2 pieces. First, a set of interop definitions packaged as a Primary Interop Assembly (PIA) for the new shim APIs. These give you low-level, direct access to the shim APIs from managed code. These can be utilized in your code using the Type Embedding" feature, which will be the default when adding it as a reference in Visual Studio. (Note: At this time, if you consume these interfaces directly, they will not work when passed across thread apartment boundaries. Consuming the managed APIs referred to below will not have this limitation.) see How to use the PIA

Second, a set of managed APIs that wrap this functionality in a more “managed API” way. These consume the PIA in the same way that 3rd party code could, but expose functionality using standard managed code concepts like properties, strings, and IEnumerables rather than their native COM counterparts. see How to use the managed wrapper API

Last edited Feb 16, 2010 at 6:13 PM by markmiller, version 8