- Checks if the assembly is Strongly signed.
- If yes it will search in the GAC
- Loader will search the policy file name in the format of
- Eg. MyPolicy.1.2.Assembly1
- If such a file exists it will look inside of it if the version of the assembly that we are trying to load matches the version/versions range written in the policy file. If it does, it will try to load the assembly with the version specified there. If no such policy file exists, it will try to load assembly from the GAC.
- If it will fail to find it in the GAC, it will start to search in the system’s search path.
In web applications it will also include the application’s Bin directory in the search path.
We like to combine Hello.dll with GoodBye.dll and put them into a Private Assembly we call GreetAssembly.dll.
DotNet> al /t:library /out:bin\Hellowroldassembly.dll bin\GoodDay.dll bin\GoodMorning.dll
For this purpose we use the Assembly Linker. As /t (target) we generate here a library referencing the two other DLLs. This is also called a Multi-Module Assembly. Again, we store all the binaries in a bin folder.
The assembly manifest contains this assembly metadata. An assembly manifest contains all the metadata needed to specify the assembly’s version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a standalone PE file that contains only assembly manifest information.
Metadata is data that describes the state of the assembly and a detailed description of each type, attribute within the assembly. Metadata stores the following information:
- Description of the assembly.
- Identity (name, version, culture, public key).
- The types that are exported.
- Other assemblies that this assembly depends on.
- Security permissions needed to run.
- Description of types.
- Name, visibility, base class, and interfaces implemented.
- Members (methods, fields, properties, events, nested types).
- Additional descriptive elements that modify types and members.
Base class is the one from which the object and references are being inherited in .net
- System.object is for .Net
- System.Web.UI is for asp.net
A full assembly reference includes the assembly’s text name, version, culture, and public key token (if the assembly has a strong name). A full assembly reference is required if you reference any assembly that is part of the common language runtime or any assembly located in the global assembly cache.
We can dynamically reference an assembly by providing only partial information, such as specifying only the assembly name. When you specify a partial assembly reference, the runtime looks for the assembly only in the application directory.
An assembly qualified name isn’t the filename of the assembly; it’s the internal name of the assembly combined with the assembly version, culture, and public key, thus making it unique.
It is a tool provided in C# to view and read the assembly content in manifest view. This tool is supplied along with the Visual Studio .NET you are using. It is also available along with .NET SDK. To access this tool, you have to run the ildasm.exe
- The GAC stores assemblies specifically designated to be shared by several applications on the computer.
- Assemblies deployed in the GAC must have a strong name.
- When an assembly is added to the GAC, integrity checks are performed on all files that make up the assembly. The cache performs these integrity checks to ensure that an assembly has not been tampered with, for example, when a file has changed but the manifest does not reflect the change.
- Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK or Use Windows Explorer to drag assemblies into the cache.
Disclaimer – F5debug Interview Questions & Answers Series:
You may recopy extracts from these pages (“the material”) to individual third parties website or to the local system internal websites for their personal information, but only if:
You acknowledge the www.f5debug.net as the source of the material. Such acknowledgment should include reference to the www.f5debug.net in the copy of the material and should also include the words ” © Karthikeyan Anbarasan, www.f5debug.net “. You inform the third party that these conditions apply to him/her and that he/she must comply with them.