Misplaced Pages

Global Assembly Cache

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

The Global Assembly Cache ( GAC ) is a machine-wide CLI assembly cache for the Common Language Infrastructure (CLI) in Microsoft's .NET Framework. The approach of having a specially controlled central repository addresses the flaws in the shared library concept and helps to avoid pitfalls of other solutions that led to drawbacks like DLL hell .

#540459

46-670: Assemblies residing in the GAC must adhere to a specific versioning scheme which allows for side-by-side execution of different code versions. Specifically, such assemblies must be strongly named . There are two ways to interact with the GAC: the Global Assembly Cache Tool (gacutil.exe) and the Assembly Cache Viewer (shfusion.dll). gacutil.exe is an older command-line utility that shipped with .NET 1.1 and

92-415: A cracker would try to pass off an assembly appearing as something else, the assembly is signed with a private key. The developer of the intended assembly keeps the private key secret, so a cracker cannot have access to it nor simply guess it. Thus the cracker cannot make his assembly impersonate something else, lacking the possibility to sign it correctly after the change. Signing the assembly involves taking

138-424: A device, device type, directory prefix, file path separator, or file type. File systems typically support organizing files into directories , also called folders , which segregate files into groups. This may be implemented by associating the file name with an index in a table of contents or an inode in a Unix-like file system. Directory structures may be flat (i.e. linear), or allow hierarchies by allowing

184-672: A directory to contain directories, called subdirectories. The first file system to support arbitrary hierarchies of directories was used in the Multics operating system. The native file systems of Unix-like systems also support arbitrary directory hierarchies, as do, Apple 's Hierarchical File System and its successor HFS+ in classic Mac OS , the FAT file system in MS-DOS 2.0 and later versions of MS-DOS and in Microsoft Windows ,

230-443: A file system creates a file, it allocates space for data. Some file systems permit or require specifying an initial space allocation and subsequent incremental allocations as the file grows. To delete a file, the file system records that the file's space is free; available to use for another file. A local file system manages storage space to provide a level of reliability and efficiency. Generally, it allocates storage device space in

276-422: A file system implementation. The physical file system layer provides relatively low-level access to a storage device (e.g. disk). It reads and writes data blocks , provides buffering and other memory management and controls placement of blocks in specific locations on the storage medium. This layer uses device drivers or channel I/O to drive the storage device. A file name , or filename , identifies

322-417: A file to consuming applications and in some cases users. A file name is unique so that an application can refer to exactly one file for a particular name. If the file system supports directories, then generally file name uniqueness is enforced within the context of each directory. In other words, a storage can contain multiple files with the same name, but not in the same directory. Most file systems restrict

368-706: A forked file system on the Macintosh, and Microsoft supports streams in NTFS. Some file systems maintain multiple past revisions of a file under a single file name; the file name by itself retrieves the most recent version, while prior saved version can be accessed using a special naming convention such as "filename;4" or "filename(-4)" to access the version four saves ago. See comparison of file systems#Metadata for details on which file systems support which kinds of metadata. A local file system tracks which areas of storage belong to which file and which are not being used. When

414-477: A granular manner, usually multiple physical units (i.e. bytes ). For example, in Apple DOS of the early 1980s, 256-byte sectors on 140 kilobyte floppy disk used a track/sector map . The granular nature results in unused space, sometimes called slack space , for each file except for those that have the rare size that is a multiple of the granular allocation. For a 512-byte allocation, the average unused space

460-455: A hash of important parts of the assembly and then encrypting the hash with the private key. The signed hash is stored in the assembly along with the public key. The public key will decrypt the signed hash. When the CLR loads a strongly named assembly it will generate a hash from the assembly and then compare this with the decrypted hash. If the comparison succeeds then it means that the public key in

506-608: A process that will use classes defined in library assemblies. CLI assemblies contain code in CIL , which is usually generated from a CLI language , and then compiled into machine language at run time by the just-in-time compiler . In the .NET Framework implementation, this compiler is part of the Common Language Runtime (CLR). An assembly can consist of one or more files. Code files are called modules. An assembly can contain more than one code module. And since it

SECTION 10

#1732780840541

552-536: A program that prints "Hello World", the equivalent CIL code for the method is: The CIL code loads the String onto the stack, then calls the WriteLine function and returns. File system In computing , a file system or filesystem (often abbreviated to FS or fs ) governs file organization and access. A local file system is a capability of an operating system that services the applications running on

598-431: A stream of bytes . Typically, to read file data, a program provides a memory buffer and the file system retrieves data from the medium and then writes the data to the buffer. A write involves the program providing a buffer of bytes that the file system reads and then stores to the medium. Some file systems, or layers on top of a file system, allow a program to define a record so that a program can read and write data as

644-585: A structure; not an unorganized sequence of bytes. If a fixed length record definition is used, then locating the n record can be calculated mathematically, which is relatively fast compared to parsing the data for record separators. An identification for each record, also known as a key, allows a program to read, write and update records without regard to their location in storage. Such storage requires managing blocks of media, usually separating key blocks and data blocks. Efficient algorithms can be developed with pyramid structures for locating records. Typically,

690-403: A subfolder called en-GB. Satellites are loaded by a CLI class called System.Resources.ResourceManager . The developer has to provide the name of the resource and information about the main assembly (with the neutral resources). The ResourceManager class will read the locale of the machine and use this information and the name of the main assembly to get the name of the satellite and the name of

736-432: A user's use of storage space. A file system typically ensures that stored data remains consistent in both normal operations as well as exceptional situations like: Recovery from exceptional situations may include updating metadata, directory entries and handling data that was buffered but not written to storage media. A file system might record events to allow analysis of issues such as: Many file systems access data as

782-405: Is 256 bytes. For 64 KB clusters, the average unused space is 32 KB. Generally, the allocation unit size is set when the storage is configured. Choosing a relatively small size compared to the files stored, results in excessive access overhead. Choosing a relatively large size results in excessive unused space. Choosing an allocation size based on the average size of files expected to be in

828-553: Is based on assemblies and evidence . Evidence can be anything deduced from the assembly, but typically it is created from the source of the assembly – whether the assembly was downloaded from the Internet, an intranet , or installed on the local machine (if the assembly is downloaded from another machine it will be stored in a sandboxed location within the GAC and hence is not treated as being installed locally). Permissions are applied to entire assemblies, and an assembly can specify

874-509: Is ignored by existing Windows file systems (FAT32 and NTFS) this would mean that there could be several files with the same PE name in one folder. Since this is not possible, satellites must be stored in subfolders under the application folder. For example, a satellite with the UK English resources will have a CLI name of "lib.resources Version=0.0.0.0 Culture=en-GB PublicKeyToken=null", a PE file name of lib.resources.dll, and will be stored in

920-534: Is invisible to the end user and the system still works correctly. However this can degrade performance on some storage hardware that work better with contiguous blocks such as hard disk drives . Other hardware such as solid-state drives are not affected by fragmentation. A file system often supports access control of data that it manages. The intent of access control is often to prevent certain users from reading or modifying certain files. Access control can also restrict access by program in order to ensure that data

966-465: Is likely to be used for the development purpose which is a shared assembly, the strong naming procedure contains only public key generation. The private key is not generated at that time. It is generated only when the assembly is deployed. The assembly is built up with the CIL code, which is an intermediate language. The framework internally converts the CIL ( bytecode ) into native assembly code . If we have

SECTION 20

#1732780840541

1012-510: Is modified in a controlled way. Examples include passwords stored in the metadata of the file or elsewhere and file permissions in the form of permission bits, access control lists , or capabilities . The need for file system utilities to be able to access the data at the media level to reorganize the structures and provide efficient backup usually means that these are only effective for polite users but are not effective against intruders. Methods for encrypting file data are sometimes included in

1058-420: Is possible to use different languages to create code modules, it is technically possible to use several different languages to create an assembly. Visual Studio however does not support using different languages in one assembly. The name of an assembly consists of four parts The public key token is used to make the assembly name unique. Thus, two strong named assemblies can have the same PE file name and yet

1104-415: Is still available with the .NET SDK. One can check the availability of a shared assembly in GAC by using the command: One can register a shared assembly in the GAC by using the command: Or by copying an assembly file into the following location: Note that for .NET 4.0 the GAC location is now: Other options for this utility will be briefly described if you use the /? flag, i.e.: The newer interface,

1150-550: Is stored inside the allocation group itself. Additional attributes can be associated on file systems, such as NTFS , XFS , ext2 , ext3 , some versions of UFS , and HFS+ , using extended file attributes . Some file systems provide for user defined attributes such as the author of the document, the character encoding of a document or the size of an image. Some file systems allow for different data collections to be associated with one file name. These separate collections may be referred to as streams or forks . Apple has long used

1196-680: The NTFS file system in the Windows NT family of operating systems, and the ODS-2 (On-Disk Structure-2) and higher levels of the Files-11 file system in OpenVMS . In addition to data, the file content, a file system also manages associated metadata which may include but is not limited to: A file system stores associated metadata separate from the content of the file. Most file systems store

1242-465: The context menu . With the launch of the .NET Framework 4, the Assembly Cache Viewer shell extension is obsolete. A computer has two CLI assemblies both named AssemblyA , but one is version 1.0 and the other is version 2.0. Since it is required that both be compiled to a file named AssemblyA, they cannot exist in the same directory within the FAT32 file system . Instead, the virtual file system of

1288-424: The Assembly Cache Viewer, is integrated into Windows Explorer . Browsing %windir%\assembly\ (for example, C:\WINDOWS\assembly ) or %WINDIR%\Microsoft.NET\assembly , displays the assemblies contained in the cache along with their versions, culture, public key token, and processor architecture. Assemblies are installed by dragging and dropping and uninstalled by selecting and pressing the delete key or using

1334-592: The CLI will recognize them as different assemblies. The Windows file system ( FAT32 and NTFS ) only recognizes the PE file name, so two assemblies with the same PE file name (but different culture, version or public key token) cannot exist in the same Windows folder. To solve this issue, the CLI introduces the GAC ( Global Assembly Cache ) that is treated as a single folder by run-time, but is actually implemented using nested file system folders. To prevent spoofing attacks , where

1380-523: The GAC can be used by programs that need to use each version of the assembly specifically. The GAC as a construct does not actually exist within the Windows OS. It is implemented and managed by the CLI. The folders within %systemroot% named assembly and Microsoft.NET\assembly (for .NET 4.0) contain all globally available assemblies with managed filenames so that the version and public key tokens can be included. Each version can therefore exist within

1426-463: The code will perform some privileged action only if all of the assemblies of all of the methods in the call stack have the specified permission. If one assembly does not have the permission a security exception is thrown. The CLI code can also perform Linked Demand for getting the permission from the call stack. In this case the CLR will look at only one method in the call stack in the TOP position for

Global Assembly Cache - Misplaced Pages Continue

1472-421: The computer main memory can be set up as a RAM disk that serves as a storage device for a file system. File systems such as tmpfs can store files in virtual memory . A virtual file system provides access to files that are either computed on request, called virtual files (see procfs and sysfs ), or are mapping into another, backing storage. From c.  1900 and before the advent of computers

1518-519: The concepts. The logical file system layer provides relatively high-level access via an application programming interface (API) for file operations including open, close, read and write – delegating operations to lower layers. This layer manages open file table entries and per-process file descriptors. It provides file access, directory operations, security and protection. The virtual file system , an optional layer, supports multiple concurrent instances of physical file systems, each of which called

1564-496: The file (and hence the public key token) is associated with the private key used to sign the assembly. This will mean that the public key in the assembly is the public key of the assembly publisher and hence a spoofing attack is prevented. CLI assemblies can have version information, allowing them to eliminate most conflicts between applications caused by shared assemblies. However, this does not eliminate all possible versioning conflicts between assemblies. CLI Code Access Security

1610-416: The file system. This is very effective since there is no need for file system utilities to know the encryption seed to effectively manage the data. The risks of relying on encryption include the fact that an attacker can copy the data and use brute force to decrypt the data. Additionally, losing the seed means losing the data. Some operating systems allow a system administrator to enable disk quotas to limit

1656-571: The filename to use the correct one. The Global Assembly Cache mechanism helps to avoid older DLL hell , but it still has some drawbacks, such as: Assembly (CLI) Defined by Microsoft for use in recent versions of Windows , an assembly in the Common Language Infrastructure (CLI) is a compiled code library used for deployment, versioning, and security. There are two types: process assemblies ( EXE ) and library assemblies ( DLL ). A process assembly represents

1702-500: The length of a file name. Some file systems match file names as case sensitive and others as case insensitive. For example, the names MYFILE and myfile match the same file for case insensitive, but different files for case sensitive. Most modern file systems allow a file name to contain a wide range of characters from the Unicode character set. Some restrict characters such as those used to indicate special attributes such as

1748-418: The minimum permissions it requires through custom attributes (see CLI metadata ). When the assembly is loaded the CLR will use the evidence for the assembly to create a permission set of one or more code access permissions. The CLR will then check to make sure that this permission set contains the required permissions specified by the assembly. CLI code can perform a code access security demand. This means that

1794-409: The name suggests, a satellite is associated with an assembly called the main assembly. That assembly (say, lib.dll) will contain the neutral resources (that Microsoft says is International English , but implies to be US English). Each satellite has the name of the associated library appended with .resources (for example lib.resources.dll). The satellite is given a non-neutral culture name, but since this

1840-595: The names of all the files in one directory in one place—the directory table for that directory—which is often stored like any other file. Many file systems put only some of the metadata for a file in the directory table, and the rest of the metadata for that file in a completely separate structure, such as the inode . Most file systems also store metadata not associated with any one particular file. Such metadata includes information about unused regions— free space bitmap , block availability map —and information about bad sectors . Often such information about an allocation group

1886-765: The same computer . A distributed file system is a protocol that provides file access between networked computers. A file system provides a data storage service that allows applications to share mass storage . Without a file system, applications could access the storage in incompatible ways that lead to resource contention , data corruption and data loss . There are many file system designs and implementations – with various structure and features and various resulting characteristics such as speed, flexibility, security, size and more. Files systems have been developed for many types of storage devices , including hard disk drives (HDDs), solid-state drives (SSDs), magnetic tapes and optical discs . A portion of

Global Assembly Cache - Misplaced Pages Continue

1932-403: The same location and be called without requiring subsequent versions to preserve code entry point locations as usual. Windows Explorer allows the drag-and-drop installation of assemblies into this folder only if they would otherwise be permitted to be installed from the command line. A calling application may specify a version of an assembly when referencing it, so the run-time can simply refer to

1978-552: The specified permission. Here the stack walk-through is bound to one method in the call stack by which the CLR assumes that all the other methods in the CALL STACK have the specified permission. The Assembly is a combination of METADATA and MSIL file. In general, assemblies should contain culture-neutral resources. If you want to localize your assembly (for example use different strings for different locales) you should use satellite assemblies – special, resource-only assemblies. As

2024-429: The storage tends to minimize unusable space. As a file system creates, modifies and deletes files, the underlying storage representation may become fragmented . Files and the unused space between files will occupy allocation blocks that are not contiguous. A file becomes fragmented if space needed to store its content cannot be allocated in contiguous blocks. Free space becomes fragmented when files are deleted. This

2070-493: The subfolder that contains it. ResourceManager can then load the satellite and obtain the localized resource. One can reference an executable code library by using the /reference flag of the C# compiler. The shared assemblies need to give a strong name for uniquely identifying the assembly that might be shared among the applications. The strong naming consists of the public key token, culture, version and PE file name. If an assembly

2116-442: The terms file system , filing system and system for filing were used to describe methods of organizing, storing and retrieving paper documents. By 1961, the term file system was being applied to computerized filing alongside the original meaning. By 1964, it was in general use. A local file system's architecture can be described as layers of abstraction even though a particular file system design may not actually separate

#540459