What Is A. Net assembly?

Source: Internet
Author: User

 AssemblyIs the main construction block of. NET Framework applications. It is a collection of functions and is generated, versioned, and deployed in the form of a single Implementation Unit (one or more files. All managed types and resources can be marked as accessible only in their implementation units, or code is marked as accessible outside the unit.
The Assembly describes itself through its list (an indispensable part of each Assembly.

Create an assembly identifier (in the form of a text name), version, culture, and digital signature (if the Assembly will be shared among applications ).
Defines the files (by name and file hash) that constitute the Assembly implementation ).
Specify the types and resources that constitute the Assembly, including the types and resources exported from the Assembly.
Compile-time dependencies on other Assembly are listed one by one.
Specify the permission set required for the Assembly to run correctly

What is the difference between the namespace name and the Assembly name?
A namespace is a type logical naming scheme. In this scheme, simple type names (such as mytype) start with the hierarchical names separated by points. Such a naming scheme is completely controlled by developers. For example, the types mycompany. fileaccess. A and mycompany. fileaccess. B may logically have file access-related functions .. . NET Framework uses a hierarchical naming scheme to divide types into logical categories of related functions (such as ASP. NET application framework) or remote processing functions.DesignTools can use namespaces to make it easier for developers to browse and reference types in code. The namespace concept is irrelevant to the Assembly concept. A single assembly can contain hierarchical names with different types of namespaces, while a logical namespace root can span multiple assemblies. In the. NET Framework, the namespace is convenient during the logic design, while the Assembly establishes a type name range during runtime.

What is a private assembly and a shared assembly?
Private assembly is only used by a single application and stored inInstallDirectory (or its subdirectories ). A shared assembly is an assembly that can be referenced by multiple applications. To share an assembly, you must give the Assembly an encrypted strong name (sometimes called a strong name) and explicitly generate the Assembly for this purpose. In contrast, the private assembly name must be unique in the application that uses it.
By distinguishing between a dedicated assembly and a shared assembly, we introduce the concept of sharing in the form of explicit decision-making. You only need to deploy a dedicated assembly to the application directory to ensure that the application runs only with the bit used to generate and deploy it. A reference to a private assembly is locally resolved to the private application directory.

You can cite multiple reasons for generating and using a shared assembly, for example, the version policy capability. The shared assembly has an encrypted strong name, which means that only the author of this Assembly has a key to generate a new version of the Assembly. Therefore, if you generate a policy statement that indicates that you want to accept the new version of the assembly, you must be sure that the version update will be controlled and verified by the author. Otherwise, you do not have to accept them.

For locally installed applications, shared assembly is usually explicitly installed into the Global Assembly Cache (local cache of the Assembly maintained by the. NET Framework ).. Net Framework VersionManagementThe key feature is that the downloaded code does not affect the execution of locally installed applications. The downloaded code is stored in a special download cache and is not globally available on the computer, even if some download components are generated in the form of shared assembly.
Classes attached to the. NET Framework are generated in the form of shared assembly.
Image example:
If the namespace is the logical organization form of the class library, the Assembly is the physical organization form of the class library. This type can be fully qualified only when the namespace of the specified type and the Assembly that implements this type are both specified. (Excerpted from "proficient in. net core technology-original and architecture" e-Industry Press)

For example, if we want to use Class A, we need to put the Assembly containing Class A (that is *. DLL) is referenced in this project (physical), and The namespace (logic) of Class A should be declared in the program ).
An assembly is a set of programs. It can be understood as a bunch of programs in a project. Generally, a project is an assembly. You can right-click the project and set the Assembly name in the properties. (Similar to DLL or EXE)
An assembly is not physically organized. For example, a file can contain multiple assemblies, and an assembly can be divided into several files.
A namespace is a type logical naming scheme. A simple type name (such as mytype) is preceded by a hierarchical name separated by points. Such a naming scheme is completely under the control of developers. For example, if you type mycompany. fileaccess. A and mycompany. fileaccess. B, you will logically have file access-related functions .. The. NET Framework uses a hierarchical naming scheme to group types by logical category of related functions, such as ASP. NET application framework or remote processing. The design tool can use namespaces to make it easier for developers to browse and reference types in code. There is no connection between the concept of a namespace and the concept of an assembly. An assembly can contain the types of its hierarchical structure names with different namespaces, while a logical namespace root can span multiple assemblies. In the. NET Framework, a namespace is a convenient way to perform logical naming during design, while an Assembly creates a name scope for the type at runtime.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.