Share via


Conteúdo do Assembly

In general, a static assembly can consist of four elements:

  • The assembly manifest, which contains assembly metadata.

  • Type metadata.

  • Microsoft intermediate language (MSIL) code that implements the types.

  • A set of resources.

Only the assembly manifest is required, but either types or resources are needed to give the assembly any meaningful functionality.

There are several ways to group these elements in an assembly. You can group all elements in a single physical file, which is shown in the following illustration.

Single-file assembly

MyAssembly.dll

Alternatively, the elements of an assembly can be contained in several files. Esses arquivos podem ser módulos de código compilado (. netmodule), recursos (como arquivos BMP ou. jpg) ou outros arquivos exigidos pelo aplicativo. Create a multifile assembly when you want to combine modules written in different languages and to optimize downloading an application by putting seldom used types in a module that is downloaded only when needed.

In the following illustration, the developer of a hypothetical application has chosen to separate some utility code into a different module and to keep a large resource file (in this case a .bmp image) in its original file. The .NET Framework downloads a file only when it is referenced; keeping infrequently referenced code in a separate file from the application optimizes code download.

Multifile assembly

MyAssembly.dll

Observação

The files that make up a multifile assembly are not physically linked by the file system.Rather, they are linked through the assembly manifest and the common language runtime manages them as a unit.

Nesta ilustração, todos os três arquivos pertencem a um assembly, conforme descrito no assemblydomanifesto contido em MyAssembly. dll. sistema de arquivos, eles são os três arquivos separados. Observe que o arquivo Util. da netmodule foi compilado como um módulo porque ele não contém nenhuma informação de assembly . Quando o assembly foi criado, o assemblydomanifesto foi adicionado ao MyAssembly. dll, indicando seu relacionamento com util. da netmodule e Graphic.

As you currently design your source code, you make explicit decisions about how to partition the functionality of your application into one or more files. When designing .NET Framework code, you will make similar decisions about how to partition the functionality into one or more assemblies.

Consulte também

Conceitos

Assemblies no Common Language Runtime

Manifesto do Assembly

Considerações sobre segurança do assembly