side-by-side assembly
   HOME

TheInfoList



OR:

Side-by-side assembly (SxS, or WinSxS on Microsoft Windows) technology is a standard for executable files in
Windows 98 Second Edition Windows 98 is a consumer-oriented operating system developed by Microsoft as part of its Windows 9x family of Microsoft Windows operating systems. The second operating system in the 9x line, it is the successor to Windows 95, and was released to ...
,
Windows 2000 Windows 2000 is a major release of the Windows NT operating system developed by Microsoft and oriented towards businesses. It was the direct successor to Windows NT 4.0, and was released to manufacturing on December 15, 1999, and was officiall ...
, and later versions of Windows that attempts to alleviate problems (collectively known as "
DLL Hell In computing, DLL Hell is a term for the complications that arise when one works with dynamic-link libraries (DLLs) used with Microsoft Windows operating systems, particularly legacy 16-bit editions, which all run in a single memory space. DLL Hel ...
") that arise from the use of dynamic-link libraries (DLLs) in Microsoft Windows. Such problems include version conflicts, missing DLLs, duplicate DLLs, and incorrect or missing registration. In side-by-side, Windows stores multiple versions of a DLL in the subdirectory of the Windows directory, and loads them on demand. This reduces dependency problems for applications that include a side-by-side
manifest Manifest may refer to: Computing * Manifest file, a metadata file that enumerates files in a program or package * Manifest (CLI), a metadata text file for CLI assemblies Events * Manifest (convention), a defunct anime festival in Melbourne, Aus ...
.
Microsoft Visual C++ Microsoft Visual C++ (MSVC) is a compiler for the C, C++ and C++/CX programming languages by Microsoft. MSVC is proprietary software; it was originally a standalone product but later became a part of Visual Studio and made available in both tri ...
2005 and 2008 employ SxS with all C runtime libraries. However, runtime libraries in Visual C++ 2010 no longer use this technology; instead, they include the version number of a DLL in its file name, which means that different versions of one DLL will technically be completely different DLLs now. SxS is also the technological basis for registration-free COM activation. Only in-process COM servers may be activated this way.


Operation

An application that employs SxS must have a ''manifest''. Manifests are typically a section embedded in the application's executable file but may also be an external file. When the operating system loads the application and detects the presence of a manifest, the operating system DLL loader is directed to the version of the DLL corresponding to that listed in the manifest. If there is no manifest, the DLL loader loads a default version of all DLL dependencies. If the DLL is a COM server, it must have a manifest of its own for registration-free activation to succeed. On
Windows Vista Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, which was released five years before, at the time being the longest time span between successive releases of ...
and later, can help to diagnose failures in the starting of applications due to SxS misconfiguration. If a user wishes to override manifest-specified assemblies (for example, in the case of security patches applied to a library), a publisher configuration file can globally redirect assemblies. Digital signatures can ensure the legitimacy of such redirection.


Manifest format

The application manifest is internally represented as
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
. The
URN An urn is a vase, often with a cover, with a typically narrowed neck above a rounded body and a footed pedestal. Describing a vessel as an "urn", as opposed to a vase or other terms, generally reflects its use rather than any particular shape or ...
associated with SxS manifests is "urn:schemas-microsoft-com:asm.v1". Several other recent Microsoft technologies such as
ClickOnce ClickOnce is a component of Microsoft .NET Framework 2.0 and later, and supports deploying applications made with Windows Forms or Windows Presentation Foundation. It is similar to Java Web Start for the Java Platform or Zero Install for Linux. ...
employ the same manifest format.


Example manifest

The following is an example of a manifest for an application that depends on a C runtime DLL.


Activation contexts

A manifest like the one above is parsed into an activation context by the SxS loader. There is a stack of activation contexts for each thread or fiber. An API allows programmatic manipulation of these contexts. It may be necessary for a library ( DLL) to change its activation context, for example if it requires a specific version of another library for its own consumption instead of using the activation context of its caller. This type of issue is sometimes called (activation context) pollution. To prevent polluting its activation context, a DLL can have a manifest embedded as a
resource Resource refers to all the materials available in our environment which are technologically accessible, economically feasible and culturally sustainable and help us to satisfy our needs and wants. Resources can broadly be classified upon their ...
, which is parsed when the DLL is loaded. This manifest must be at resource id 2 in the image file for the loader to find it.


WinSxS (Windows component store)

From Vista onward, the Windows operating system uses WinSxS for its core components. Operating system files in the directory are hard linked from their usual locations in the Windows directory structure. A file in a subdirectory in may be linked from multiple locations (e.g. the directory and application directories).
Windows Explorer File Explorer, previously known as Windows Explorer, is a file manager application that is included with releases of the Microsoft Windows operating system from Windows 95 onwards. It provides a graphical user interface for accessing the file ...
double-counts the disk space occupied by these files. This can be demonstrated using the fsutil command-line program. Some third-party Explorer extensions to show the link count also exist. However, not all files from are projected this way to "live" operating system files. For example, after installing some Windows updates, old file versions replaced by the updates are still kept in although they are no longer linked in the "live" Windows directories. This allows updates to be uninstalled safely. Because of its elevated importance, from Vista onward the directory is owned by the Trusted Installer service SID. By default not even administrators can modify its contents (without taking ownership first). Uninstalling applications does not immediately free space in the directory; space for unused assemblies is garbage-collected over time by the Installer service. Although not officially documented, the algorithm for generating the directory names residing inside the directory has been made public on an
MSDN Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
Microsoft employee's blog. The algorithm was changed in the transition from XP to Vista. Windows 7 includes Windows AIK tool Deployment Image Servicing and Management (DISM) which can remove files used by superseded OS updates using the Trusted Installer worker service, without the need to reboot or take down the system; post-SP1 updates add Windows Update cleanup to the Disk Cleanup tool () and the downloadable System Update Readiness tool (CheckSUR) which can repair components store errors and replace corrupt or missing OS files with known good versions. Windows 8 integrates repair capability to the DISM tool which is now able to copy valid OS files from Windows Update or an offline WIM image, as well as reset the component store to only contain the latest versions of OS components. Windows 10 runs the automatic task to clean up the component store.


Advantages

* For applications that have been built with SxS, multiple applications may coexist that depend on different versions of the same DLL. This is in contrast to non-SxS DLL environments where an original DLL in a shared system folder may be overwritten by the subsequent installation of another program that depends on a different version of the same DLL. * The XML formatting of the manifest is human-legible and thus makes it easier for developers to determine the dependencies of an application and their versions.


Disadvantages

* In Windows XP, a bug in causes heap corruption, leading to application crashes. This issue is not fixed by any XP service pack. Users must manually install an appropriate update. * Considerably higher apparent disk space consumption, even though most of the contents of are just additional hard links to files that exist elsewhere. * The directory and Windows Update logs may become corrupted as they grow in size, because security updates add multiple new versions of critical system components to the store. In Windows Vista there is no supported way to significantly reduce the size of the directory.


Disk space

While the directory is extremely large and contains multiple versions of many files, there are some files elsewhere in the Windows folder (e.g. ) that are hardlinks to files in the directory. Thus, programs estimating the size of the Windows folder must be careful not to add the size of additional hard links to a file after one has already been counted. DIR and Explorer fail to check for hard links, and so may count the same file multiple times, adding incorrectly to the perceived disk usage. The disk usage reported by these two programs is as if each hard link is an actual file. Since Windows 8.1, the DISM tool can be used to analyze the component store and report its actual size.


References

{{Reflist


External links


Side-by-Side Assemblies (Windows)

ClickOnce Deployment Manifest Format

Configuring .NET-Based Components for Registration-Free Activation

Diagnosing SideBySide failures

Diagnose SideBySide failures in Windows XP/Windows Server 2003
Articles with example code Windows administration