Search code examples
.netdocumentationclrassembliesgac

Why does the GAC folders structure is not documented?


Why does the GAC folders structure is not documented?

I am reading the CLR via C# book and in the book it is stated that:

The reason that CSC.exe doesn’t look in the GAC for referenced assemblies is that you’d have to know the path to the assembly file and the structure of the GAC is undocumented.

I can not understand what are the obstacles in creating the rules and documenting them for the GAC folders structure.

UPDATE In the comments it was suggested that there is might be a technical issue, which does not allow to implement the rules for the folders structure. But I can prove that it is not the case by providing an example of a possible rule:

1 GAC can contain only strongly named assemblies. 2 By definition strongly named assembly is an assembly which has a name, a version number, a culture and a public key token (actually the public key, but we can use the token for simplicity, since the public key is too long). 1 2 -> 3 Each assembly can be uniquely identified by the name, version, culture and the public key token. 3 -> 4 If we use the following folders structure rule, then we will satisfy the initial objective of providing the desired folders structure rule: [name]/[version]/[culture]/[public key token]/[assembly itself]

Am I missing something here?


Solution

  • The .NET initial standard documents only define the functionalities of GAC, but not restrict its implementation. Therefore,

    • .NET Framework 2.x/3.x has an initial implementation.
    • .NET Framework 4.x uses a different implementation.
    • Other implementations like Mono use their own structures.

    Most importantly, .NET Core even has no GAC.

    As a result, C# compiler cannot rely on GAC's implementation for its reference search algorithm.