What exactly is an Assembly in C# or .NET?

前端 未结 9 1662
自闭症患者
自闭症患者 2020-11-28 02:43

Could you please explain what is an Assembly in C# or .NET?

  1. Where does it begin and where does it end?
  2. What important information should I know about
9条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 03:29

    Here's another explanation of the make up of .NET Assemblies, a mini-quote:

    The .NET framework consists of the concepts of modules, assemblies, which both store metadata and manifest information. An assembly can contain multiple modules. Visual C# only ever creates one module which is turned into an assembly by the C# compiler (csc.exe), but an assembly can link many .NET modules together via the assembly linker (al.exe) command-line tool. For example each of your source code .cs files could be compiled into a module and linked together to form an assembly - an assembly is just a collection of modules and resources. One of these modules, however; must contain manifest metadata (see below) information for the assembly to be understood by the CLR.
    ....
    Having created a new .exe or .dll inside VS.NET you see your file appear inside your bin folder. Opening it in notepad will give out gibberish, or even inside a hexadecimal editor without knowing the structure of the file, you need a tool like ildasm.exe or CFF explorer to make meaning from it. The structure of the assembly is as follows:

    PE header
    CLR header
    CLR metadata
    CLR
    IL code
    Native data

提交回复
热议问题