Gac.sxp Archive File

The Global Assembly Cache (GAC) is a directory containing Shared Assemblies and is located in the file system under %Windows%\Assembly. The GAC stores global components and can keep multiple versions of an individual file (even with the same file name). The GAC is also known as Fusion.

The location of the GAC is specified in the registry under HKLM\Software\Microsoft\Fusion.

The Global Assembly Cache (GAC) is automatically installed with the .NET runtime system. The assemblies in the GAC have their own reference counting. To correctly handle this references counting, all changes in the GAC are recorded and installed using the Fusion API.

The Packager stores changes made to the GAC in the gac.sxp archive file.

The gac.sxp archive file can contain any number of the following sections:

n is the sequence number of the archive file (1, 2, 3, and so on).

An example follows that shows how a gac.sxp archive file containing one CreateAssembly and one DeleteAssembly section looks like:

#Sign#
ArchiveName=gac_xmpl
Release=4002
SXP=1.0
#Locale#
Codepage=3
#CreateAssembly1#
AsmDisplayName=MyAsm, Version=1.0.2879.30837, Culture=GER, PublicKeyToken=316630fb36ca936c
AsmFile=$(SxpWinDir)\assembly\GAC\MyAsm\1.0.2879.30837_GER_316630fb36ca936c\MyAsm.dll
Ref.Size=32
Ref.Flags=0
Ref.guidScheme=Data1=2ec93463 Data2=b0c3 Data3=45e1 Data4=8364327e96aea856
Ref.Identifier=SXP
Ref.NonCanonicalData=Created by SXP Installer
#DeleteAssembly1#
AsmDisplayName=MyAsm, Version=1.0.2879.30837, Culture=GER, PublicKeyToken=316630fb36ca936c
AsmFile=$(SxpWinDir)\assembly\GAC\MyAsm\1.0.2879.30837_GER_316630fb36ca936c\MyAsm.dll
Ref.Size=32
Ref.Flags=0
Ref.guidScheme=Data1=2ec93463 Data2=b0c3 Data3=45e1 Data4=8364327e96aea856
Ref.Identifier=Test
Ref.NonCanonicalData=MyReferenz

The AsmDisplayName and AsmFile entries are mandatory.

The Ref.xxx entries are optional and specify a reference to install. An assembly is only removed from the GAC when all references are deleted. This means that the SXP Installer removes an assembly from the GAC, only if the assembly specified in the DeleteAssemblyn section deletes the last reference. Otherwise, only the reference is deleted. Accordingly, the SXP Installer installs the reference only when the assembly in a CreateAssemblyn section is already installed.

If the reference entries are missing in a CreateAssemblyn section, the assembly is installed without a reference.

Assemblies that are installed by the Microsoft Installer (MSI) have a special GUID scheme (FUSION_REFCOUNT_MSI_GUID defined in fusion.h). Only the Microsoft Installer can use this GUID scheme when installing assemblies. Therefore, the SXP Installer changes the GUID scheme before it performs an installation. The SXP Installer substitutes the MSI GUID scheme with the OPAQUE GUID scheme and changes the Identifier from MSI to SXP.

The registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Fusion, where the Fusion API stores information about the assemblies, is excluded from the registry scan performed by the SXP Packager.

During the uninstallation of an SXP package, assemblies deleted during the installation of the package are not restored.