What is. NET?
...
How does. NET change the entire software installation?
. NET has changed many ways for us to install software. The most obvious thing is that we have a new Language C #. Also, the operating system has undergone subtle changes and the way it handles shared code.
Metadata (Metadata)
First, you must understand what is Managed Code? All the Code based on Microsoft's intermediate language (MSIL) is Managed Code. For example, C #, a new language launched by. NET, runs completely in the Management Code. Other languages attached to Visual Studio. NET, such as Visual C ++, allow mixed use of Managed Code and None-managed Code.
What are the characteristics of Managed Code? The biggest difference between it and None-Managed Code is that it contains Metadata (Metadata ). Metadata describes every element in the Code, allows the. NET Runtime Library to manage it, and allows the code to Self-Describing ).. The NET Runtime library uses metadata to provide services such as memory management, cross-language integration, code security, and automatic object lifecycle control. Simply put, Managed Code is the Code that can be run in contract cooperation with the. NET Runtime Library.
Metadata can include assemblies, files that can be loaded, types, methods, and so on. Assembly manifest is the most closely related to production and installation. Assembly is a main component of a program, including all functions and version information, and is released as a whole. Each Assembly should contain an assembly manifest, and make the assembly customizable. Manifest includes:
- Indicates the assembly identifier and version in text. If you want to share it with other programs, you must also include a digital signature.
- Description file
- Specifies the type and resource of the assembly and the output of the assembly.
- List all dependent assemblies.
- Permission required for running
Manifest also includes data previously completed by Self-Registration. For example, all types of information are stored in Manifest, and all the Manifest data is stored in. DLL or. EXE files. In this way, we can easily know the dependency between Managed codes through Manifest without missing any information. However, if it is a mix of Managed Code and None-Managed Code, it is not that easy to achieve.
If there is no new installation technology, developers will face a major challenge.
Misunderstanding of Self-installation code
One of them is that the software written using Managed Code does not need to be installed. Because some installation tasks have been completed by metadata, such as the registration of COM components. You only need to copy all the files in the program to a directory and then run the program directly. Unfortunately, this is not the whole process of software installation.
Software Installation does not simply copy files from location A to location B. The software installer should provide users with a friendly, reliable and unified way to install the software on their machines. First, the installer needs to use a unified and familiar user interface to allow users to select installation options, and then create folders, shortcuts, upgrade, network installation, and license management. In the above example, you cannot complete all these tasks for users, not to mention license management.
In addition, applications mixed with Managed Code and None-managed Code cannot be self-installed. In addition, installing such a program is more troublesome than installing pure None-managed Code. It is impossible for us to discard all the previous Code and convert all the Code into Managed Code. Therefore, we have to seriously consider this issue.
Isolated Applications and Side-by-Side Components
On Windows XP and. NET platforms, Microsoft provides a mechanism to reduce the occurrence of DLL Hell. We know that applications generally rely on shared resources. Sharing means that if a resource is already installed on the system, the application no longer needs to install the resource, you can use it directly. So the DLL Hell happens in this way. If an application requires a resource with a higher version than the existing shared resource version on the system, it replaces the old version with a new version of the resource. In addition, the resources of the new version cannot be compatible with those of the old version. Only one version of the resource exists in the system, so the application dependent on the resource of the old version will crash!
To solve this problem, Microsoft provides two methods: Isolated Applications and Side-by-Side Components.
The Isolated Application is to include the Isolated Version of all components of the Application (Isolated Version) when the Application is released, so that it will not be affected by other installation programs. But this requires a complete rewrite of the Code, which is too costly.
The Side-by-Side component can run in an environment where shared resources of the new and old versions coexist. Many shared resources in Windows XP are written in Side-by-Side mode. Developers can use Application Manifest to achieve the advantages of Side-by-Side. Application Manifest describes the version information of the component on which the program depends. Therefore, the operating system can load the correct shared resources based on the information. For example, the Application is developed on the V5 of COMCTL32, And the V5 version dependent on COMCTL32 is specified in Application Manifest. Now, even if another version of COMCTL32 exists on the system, the operating system will still load resources of the V5 version for the program.
.....