Side-by-side technology is a standard for executable files in Windows 98 Second EditionWindows 2000, and later versions of Windows that attempts to alleviate problems that arise from the use of dynamic-link libraries 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 WinSXS subdirectory of the Windows directory, and loads them on demand. This reduces dependency problems for applications that include a side-by-side manifest.

Side-by-side technology is also known as WinSxS or SxS, although technically WinSxS refers only to the global side-by-side store (officially called the "Windows component store"), which is conceptually the native equivalent of the .NET Global Assembly Cache. Executables that include an SxS manifest are designated SxS assemblies.

Microsoft Visual C++ 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.[1][2]

SxS is also the technological basis for registration-free COM activation. Only in-process COM servers may be activated this way.

Operation[edit]

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 and later, application start failures due to SxS misconfiguration can be diagnosed using sxstrace.exe.

Because it is sometimes desirable to override manifest-specified assemblies anyway, for example in the case of security patches applied to a library, a publisher configuration file can globally redirect assemblies. Digital signatures may be used to ensure that this redirection is legitimate.[3]

Manifest format[edit]

The manifest is internally represented as XML. The URN associated with SxS manifests is "urn:schemas-microsoft-com:asm.v1".

Several other recent Microsoft technologies such as ClickOnce employ the same manifest format.

Example manifest[edit]

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

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
</assembly>

Activation contexts[edit]

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.[4] To prevent polluting its activation context, a DLL can have a manifest embedded as a resource, 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.[5]

WinSxS[edit]

From Vista onward the operating system also uses WinSxS for its core components. Operating system files in the WinSxS directory are hard linked to their usual locations in the Windows directory structure. The same file may be linked from a directory in WinSxS and from, say, the System32 directory. Windows Explorer double counts the disk space occupied by these files.[6] This can be demonstrated using the fsutil command-line program.[7] (Some third-party Explorer extensions to show the link count also exist.) However not all files from WinSxS 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 WinSxS although they are no longer linked in the "live" Windows directories. This allows updates to be uninstalled safely.[8]

Because of its elevated importance, from Vista onward the WinSxS 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 WinSxS directory; space for unused assemblies is garbage-collected over time by the Installer service.[9]

Although not officially documented, the algorithm for generating the directory names residing inside the WinSxS directory has been made public on an MSDN Microsoft employee's blog. The algorithm was changed in the transition from XP to Vista.[10]

Advantages[edit]

  • 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[edit]

  • In Windows XP, a bug in sxs.dll causes heap corruption, leading to application crashes. This issue is not fixed by any XP service packs. Users must manually install a QFE (Quick Fix Engineering).[11]
  • Considerably higher disk space consumption. The winsxs directory typically starts at several gigabytes in size and continues to grow as applications are installed. Further, there is currently no supported way to significantly reduce the size of the winsxs directory.[8]

Misconceptions[edit]

The winsxs directory is thought to be much larger than it actually is. The directory contains mostly "hard links" to files that exist elsewhere. DIR and Explorer are not aware of the difference between an actual file and a hard link to a file, and so may count the same file several 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.[12][13]

See also[edit]

Notes[edit]

  1. Jump up^ Section "Visual C++ Libraries" in Breaking Changes in Visual C++. Retrieved on 2010-09-10.
  2. Jump up^ See section "Differences between Visual C++ 2008 and Visual C++ 2010" in "Deployment in Visual C++ 2010". Retrieved on 2010-09-10.
  3. Jump up^ http://msdn.microsoft.com/en-us/library/Aa375680
  4. Jump up^ http://blogs.msdn.com/b/jonwis/archive/2006/01/07/510375.aspx
  5. Jump up^ http://blogs.msdn.com/b/jonwis/archive/2006/01/17/514192.aspx
  6. Jump up^ http://support.microsoft.com/kb/2592038
  7. Jump up^ http://blogs.technet.com/b/joscon/archive/2010/08/06/should-you-delete-files-in-the-winsxs-directory-and-what-s-the-deal-with-vss.aspx
  8. Jump up to:a b Huges, Jeff. "What is the WINSXS directory in Windows 2008 and Windows Vista and why is it so large?". Microsoft Corporation. Retrieved 15 March 2011.
  9. Jump up^ http://blogs.msdn.com/b/jonwis/archive/2007/01/02/deleting-from-the-winsxs-directory.aspx
  10. Jump up^ http://blogs.msdn.com/b/jonwis/archive/2005/12/28/507863.aspx
  11. Jump up^ http://support.microsoft.com/kb/943232
  12. Jump up^ http://blogs.msdn.com/b/e7/archive/2008/11/19/disk-space.aspx
  13. Jump up^ http://www.davidlenihan.com/2008/11/winsxs_disk_space_usage_its_no.html

External links[edit]

from:http://en.wikipedia.org/wiki/Side-by-side_assembly

 

Side-by-side assembly的更多相关文章

  1. 为C# as 类型转换及Assembly.LoadFrom埋坑!

    背景: 不久前,我发布了一个调试工具:发布:.NET开发人员必备的可视化调试工具(你值的拥有) 效果是这样的: 之后,有小部分用户反映,工具用不了(没反应或有异常)~~~ 然后,建议小部分用户换个电脑 ...

  2. ASP.NET Core: You must add a reference to assembly mscorlib, version=4.0.0.0

    ASP.NET Core 引用外部程序包的时候,有时会出现下面的错误: The type 'Object' is defined in an assembly that is not referenc ...

  3. An error occurred during the installation of assembly 'Microsoft.VC90.CRT……的问题

    有一段时间没有用到AnkhSvn了,今天工作需要安装了一下.结果安装到一半就无法继续了,提示An error occurred during the installation of assembly ...

  4. Beennan的内嵌汇编指导(译)Brennan's Guide to Inline Assembly

    注:写在前面,这是一篇翻译文章,本人的英文水平很有限,但内嵌汇编是学习操作系统不可少的知识,本人也常去查看这方面的内容,本文是在做mit的jos实验中的一篇关于内嵌汇编的介绍.关于常用的内嵌汇编(AT ...

  5. MAC上安装 HLA(High Level Assembly)

    1.安装HLA 最新版的hla汇编器可在这里下载,支持MacOs,Linux,Windows平台 2.安装步骤 将下载好的hla程序包放在Mac根目录下 最重要的一步是设置好环境变量,打开Mac根目录 ...

  6. .NET 程序集Assembly使用

    概述 一直以来,我们都在用C#编写程序,编写程序的时候,我们用到继承.多态.接口以及泛型,我们也都明白子类可以继承抽象类,并能够重写父类的抽象方法,可是大家是否想过,如下几个问题: 1.凡树必有根和叶 ...

  7. configuration error-could not load file or assembly crystaldecisions.reportappserver.clientdoc

    IIS启动网站后报错: configuration error Could not load file or assembly 'crystaldecisions.reportappserver.cl ...

  8. Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its de

    页面加载时出现这个错误: Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Cul ...

  9. How to make your assembly more secure from referencing by unauthorized bits

    Now the security has a trend to become more and more important in our daily work, hence I did some r ...

  10. Linux+Mono+WebService:CS1703: An assembly with the same identity--mscorlib

    最近把一些东西开始往Linux迁移了,因为老系统大部分都是.NET,所以直接使用Mono,代码一般都使用MonoDevelop把代码重新编译,把一些WMI和windows DLL调用改Linux的os ...

随机推荐

  1. WCF学习笔记 -- 如何用C#开发一个WebService

    假设所有工程的命名空间是demo. 新建一个C#的ClassLibrary(类库)工程. 在工程引用中加入System.ServiceModel引用. 定义接口,你可以删除自动生成的代码,或者直接修改 ...

  2. 使用PSD设计网页页面

    一.一个独立的页面 1.分析这个页面,在脑海或草稿上要确立页面板块布局(如版块区域的,位置和大小)2.根据设计稿的的情况,分析背景图的分布.ICO图的分布等 3.切割相应的图片,导出.合并图片(一般用 ...

  3. 鼠标按键自定义软件-X-Mouse Button Control

    转载说明 本篇文章可能已经更新,最新文章请转:http://www.sollyu.com/mouse-button-x-mouse-button-custom-software-control/ 说明 ...

  4. makefile missing separator. Stop

    ifneq ($(KERNELRELEASE),) obj-m := hello.o else PWD := $(shell pwd) KVER := $(shell uname -r) KDIR : ...

  5. 结构型模式——Adapter

    1.意图 将一个类的接口转换成客户希望的另一个接口.使得原本由于接口不兼容而不能一起工作的那些类可以一起工作. 2.结构 类适配器 对象适配器 3.参与者 Target定义Client使用的与特定领域 ...

  6. DCL_数据库控制语言

    DCL(Data Control Language)              -------是数据库控制语言.是用来设置或更改数据库用户或角色权限的语句,包括(grant,deny,revoke等) ...

  7. 《APUE》第6章练习1

    问题:编写一个程序,它调用uname并输出utsname结构中的所有字段,并将输出与uname(1)命令的输出结构做比较. 我本来以为utsname结构也跟passwd结构一样,也有那三个函数来获取整 ...

  8. linux 学习笔记3

    ①find -name *.txt //查看当前目录所有文件 .txt 结尾文件 ②whereis *.txt   //查看.txt结尾文件   但不显示 .txt 打包:tar -cf a.tar ...

  9. YII千万级PV架构经验分享--俯瞰篇--架构即产品

    hello,大家好,我是方少,今天想问大家一个问题,如果我们自己就是产品,那么我们怎样才能说服别人,我们是最优秀的呢?高学历,不错,别人成功过了.会php,java,c#,python不行再学c++, ...

  10. Catalyst揭秘 Day6 Physical plan解析

    Catalyst揭秘 Day6 Physical plan解析 物理计划是Spark和Sparksql相对比而言的,因为SparkSql是在Spark core上的一个抽象,物理化就是变成RDD,是S ...