Isolated Applications and Side-by-side Assemblies

As I stated in my introduction, Fusion team really has two sub teams. One is Fusion/CLR, or simply called fusion. The other one is Fusion/Win32, or commonly called SxS (SideBySide). 

 

I have more or less talked about fusion/CLR for more than a year now. Today I am going to talk a little bit about SxS. 

 

This is the beginning of my discussion on SxS technology. In the future, Fusion/CLR post will show up in both fusion and .Net framework categories, while SxS post will be in both fusion and Win32 categories.

 

MSDN documentation for SxS is here:

 

https://msdn.microsoft.com/library/default.asp?url=/library/en-us/sbscs/setup/isolated_applications_and_side_by_side_assemblies_start_page.asp

 

MSDN listed SxS document under Win32 and COM Development \ Setup. SxS is not really a setup technology. Rather, it is an Application Deploymenttechnology.

 

Fusion/CLR and SxS shares many similarities. After all, they are the same technology with different implementation.

 

The fusion model is based on assemblies.

 

Assembly is a deployment unit. Assemblies can be private, or shared. Shared assemblies are put into a special system wide store. In fusion/CLR, this is GAC. In SxS, this is WinSxs (lives in %Windir%\WinSxs in Windows XP/Windows Server 2003). The system store is version aware so different versions of the same assemblies can exist side by side.

 

Applications consume assemblies. Assemblies are only resolved in two locations, the system wide store, and application base.

 

Applications can use application config file to redirect assemblies to different version. Shared assemblies vendors can use publisher policy to service assemblies.

 

There is no machine.config for SxS.

 

There are some big differences between fusion/CLR and SxS.

 

1. Fusion/CLR is built on top of CLR metadata, while SxS is built on top of manifest XML files.

 

Fusion/CLR is part of CLR. It can leverage the rich metadata format CLR has. SxS does not have the luxury, since it works with unmanaged binaries.

 

2. Fusion/CLR isolation is based on AppDomain, while SxS isolation boundary is Activation Context.

 

3. Fusion/CLR is a dynamic assembly loading model, while SxS is a static application model.

 

In Fusion/CLR, the entry point is assembly loading. You enter Fusion/CLR when you are loading an assembly. You have many different ways to load assemblies. Assemblies are loaded on demand. For Fusion/CLR, application is just a normal assembly with a special property --- it is the entry assembly of an AppDomain.

 

In SxS, the entry point is application. When you create an Activation Context, you have to give SxS an application manifest. During the Activation Context Creation, SxS will find the transitive closure of dependencies of the application manifest. Once the Activation Context is created, the set of assemblies are fixed --- You cannot load any other assemblies in that Activation Context. In fact, there is no Assembly load APIs at all.