Wednesday 30 July 2008

Windows Side-by-Side Assemblies

What are WinSxS assemblies? You will find them in the C:\Windows\winsxs folder in Vista/XP. This folder is also known as the "native assembly cache".

My Vista install has over 6000 SxS assemblies (ranging from WinHTTP control to GDI+). According to MSDN, these assemblies are typically single DLLs described by a manifest (although an assemly can also bunch together DLLs, Windows classes, COM servers etc). The manifest describes the assembly AND its dependencies. I also have an XP PC which has only 1400 SxS assemblies.

From XP onwards, applications can use multiple versions of a single SxS assembly.

But what is the point of an SxS assembly?

An SxS assembly is effectively a DLL - a DLL with metadata described by a manifest - that is used by the Operating System as (to quote MSDN) "a fundamental unit of naming, binding, versioning, deployment, and configuration".

This MSDN page provides a flavour of the kinds of side-by-side assemblies that are out there.

I would define an SxS assembly as "an operating system DLL with dynamic version control". So at run-time a running program can use multiple versions of the same DLL simultaneously.

Paraphrasing, SxS assembly is a way of versioning DLLs, hosting multiple versions on the same system i.e. same machine and OS, and with versioning of course comes deployment, how do we deploy different versions of DLL on the same system, and how does our software know which version to use? It's a core part of the Windows platform.

No comments: