dotNet Assembly basic (a overall topic Assemblies and the Global Assembly Cache can be found in MSDN)
Assemblies have the following properties:
Assemblies are implemented as .exe or .dll files.
You can share an assembly between applications by placing it in the Global Assembly Cache.
Assemblies must be strong-named before they can be placed in the Global Assembly Cache. For more information, see Strong-Named Assemblies.
Assemblies are only loaded into memory if they are required. When loading a assembly, its dependency assemblies specified by references will be loaded automatically (resource dll loading follows the same rule).
You can programmatically obtain information about an assembly using reflection. For more information, see the topic Reflection.
If you want to load an assembly only to inspect it, use a method such as ReflectionOnlyLoadFrom.
You can use two versions of the same assembly in a single application. For more information, see extern alias.
Loading when required means implicit assembly loading. If you want to explicitly load a dotNet assembly, there are many choices to do. The most suggested one is to use System.Reflection.Assembly.Load.
There are several ways to load an assembly into an application domain. The recommended way is to use the static (Shared in Visual Basic) Load method of the System.Reflection.Assembly class. Other ways assemblies can be loaded include:
The LoadFrom method of the Assembly class loads an assembly given its file location. Loading assemblies with this method uses a different load context.
The ReflectionOnlyLoad and ReflectionOnlyLoadFrom methods load an assembly into the reflection-only context. Assemblies loaded into this context can be examined but not executed, allowing the examination of assemblies that target other platforms. See How to: Load Assemblies into the Reflection-Only Context.
Note |
---|
The reflection-only context is new in the .NET Framework version 2.0. |
Methods such as CreateInstance and CreateInstanceAndUnwrap of the AppDomain class can load assemblies into an application domain.
The Load method of the System.AppDomain class can load assemblies, but is primarily used for COM interoperability. It should not be used to load assemblies into an application domain other than the application domain from which it is called.
Note |
---|
Starting with the .NET Framework version 2.0, the runtime will not load an assembly that was compiled with a version of the .NET Framework that has a higher version number than the currently loaded runtime. This applies to the combination of the major and minor components of the version number. |
You can specify the way the just-in-time (JIT) compiled code from loaded assemblies is shared between application domains. For more information, see Application Domains and Assemblies.
C++ VS dotNet
Both support implicit / explicit assembly loading:
Global Assembly Cache(MSDN link)
It's a machine-wide code cache where to store assemblies that intend to be shared between applications. dotNet assemblies should always be deployed there; and you can install your assemblies into GAC by gacutil.exe mainly. You can easily find steps to action on it in detail by google.
Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.
You should share assemblies by installing them into the global assembly cache only when you need to. As a general guideline, keep assembly dependencies private, and locate assemblies in the application directory unless sharing an assembly is explicitly required. In addition, it is not necessary to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.