.NET Assembly File Format

https://docs.microsoft.com/en-us/dotnet/standard/assembly/file-format

.NET defines a binary file format - "assembly" - that is used to fully-describe and contain .NET programs.

Assemblies are used for the programs themselves as well as any dependent libraries.

A .NET program can be executed as one or more assemblies, with no other required artifacts, beyond the appropriate .NET implementation.

Native dependencies, including operating system APIs, are a separate concern and are not contained within the .NET assembly format, although are sometimes described with this format (for example, WinRT).

Each CLI component carries the metadata for declarations, implementations, and references specific to that component. Therefore, the component-specific metadata is referred to as component metadata, and the resulting component is said to be self-describing – from ECMA 335 I.9.1, Components and assemblies.

The format is fully specified and standardized as ECMA 335.

All .NET compilers and runtimes use this format.

The presence of a documented and infrequently updated binary format has been a major benefit (arguably a requirement) for interoperability.

The format was last updated in a substantive way in 2005 (.NET 2.0) to accommodate generics and processor architecture.

The format is CPU- and OS-agnostic.

It has been used as part of .NET implementations that target many chips and CPUs.

While the format itself has Windows heritage, it is implementable on any operating system.

Its arguably most significant choice for OS interoperability is that most values are stored in little-endian format.

It doesn’t have a specific affinity to machine pointer size (for example, 32-bit, 64-bit).

The .NET assembly format is also very descriptive about the structure of a given program or library.

It describes the internal components of an assembly, specifically: assembly references and types defined and their internal structure.

Tools or APIs can read and process this information for display or to make programmatic decisions.

Format

https://en.wikipedia.org/wiki/Portable_Executable

The .NET binary format is based on the Windows PE file format. In fact, .NET class libraries are conformant Windows PEs, and appear on first glance to be Windows dynamic link libraries (DLLs) or application executables (EXEs). This is a very useful characteristic on Windows, where they can masquerade伪装 as native executable binaries and get some of the same treatment (for example, OS load, PE tools).

Assembly Headers from ECMA 335 II.25.1, Structure of the runtime file format.

Processing the Assemblies

It is possible to write tools or APIs to process assemblies.

Assembly information enables making programmatic decisions at runtime, re-writing assemblies, providing API IntelliSense in an editor and generating documentation.

System.Reflection and Mono.Cecil are good examples of tools that are frequently used for this purpose.

原文地址:https://www.cnblogs.com/chucklu/p/11214992.html

时间: 2024-07-29 06:51:21

.NET Assembly File Format的相关文章

dnSpy PE format ( Portable Executable File Format)

Portable Executable File Format PE Format  微软官方的 What is a .PE file in the .NET framework? [closed] The PE file you are talking about is the "Portable Executable" format. Almost every EXE and DLL on the Windows platform is formatted in PE format

The Portable Executable File Format from Top to Bottom(每个结构体都非常清楚)

The Portable Executable File Format from Top to Bottom Randy KathMicrosoft Developer Network Technology Group Created: June 12, 1993 Click to open or copy the files in the EXEVIEW sample application for this technical article. Click to open or copy t

遇到一个奇葩的问题,could not load the assembly file XXX downloaded from the Web

在我这编译好好滴,发给客户那边居然不通过,报could not load the assembly file:///xxx.dll, 查阅了一些文档后,发现原来是文件的安全问题,是由于我把文件压缩打包后, 放在网盘上,让对方下载,对方下载后,VS就认为是从网上下载的文件,不安全, 解决方案:关闭VS,在有问题的DLL上点击右键,UNBLOCK该文件, 再次打开VS,编译就OK啦,还有个小技巧:如果你是打包的文件, 那么解压后所有的DLL,都要UNBLOCK,OH NO,这是要死人的节奏啊, bu

ShopEx访问提示Incompatible file format: The encoded file has format major ID 2, whereas the Loader expects 4

今天测试了下ShopEx程序,但是ShopEx安装时(程序放在public_html目录下的test目录中)遇到了问题,提示错误如下:Fatal error: Incompatible file format: The encoded file has format major ID 2, whereas the Loader expects 4 in /home/cpusername/public_html/test/core/include_v5/defined.php on line 0检

Java class file format specfication

Java class file format spec Link: https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html Here is an example: -----------------------------------------------------java source file---------------------------------------------------------public

MySQL错误Incorrect file format解决方案

一台mysql 服务器,机器意外重启后,N个表报错,想必你已经知道库的引擎是myisam 的了,太悲催,太蛋碎了,先看看报错信息: mysql> desc PARTITION_KEYS; ERROR 130 (HY000): Incorrect file format 'PARTITION_KEYS' mysql> check table PARTITION_KEYS; +-------------------------+-------+----------+----------------

3ds Max File Format (Part 1: The outer file format; OLE2)

The 3ds Max file format, not too much documentation to be found about it. There are some hints here and there about how it’s built up, but there exists no central documentation on it. Right now we are in the following situation. A few thousand of max

Does the OpenSceneGraph have a native file format?

From OpenSceneGraph-3.0 onwards we have new native file formats based on generic serializers that are extensible and support forward/backward compatibility, there is a .osgt ascii text file format, .osgx xml format and .osgb binary format. The extens

JVMS Specification(3)-The class File Format

Subsections 3 The class File Format 3.1 The ClassFile Structure 3.2 The Internal Form of Names 3.2.1 Binary Class and Interface Names 3.2.2 Unqualified Names 3.3 Descriptors and Signatures 3.3.1 Grammar Notation 3.3.2 Field Descriptors 3.3.3 Method D