什么是.NET程序集?我在网上浏览了一下,我不明白这个定义。
当前回答
汇编是. net框架编程的基本部分。 它包含CLR在可移植可执行文件中执行MSIL(Microsoft中间语言)代码的代码,如果它没有关联的程序集清单,将不会执行。
其他回答
维基百科说:
In the Microsoft .NET framework, an assembly is a partially compiled code library for use in deployment, versioning and security. There are two types: process assemblies (EXE) and library assemblies (DLL). A process assembly represents a process which will use classes defined in library assemblies. .NET assemblies contain code in CIL, which is usually generated from a CLI language, and then compiled into machine language at runtime by the CLR just-in-time compiler. An assembly can consist of one or more files. Code files are called modules. An assembly can contain more than one code module and since it is possible to use different languages to create code modules it is technically possible to use several different languages to create an assembly. Visual Studio however does not support using different languages in one assembly.
如果你真的浏览过,澄清你不理解的地方会有帮助
在Microsoft.Net中,程序集是代码版本安全、部署和可重用性的最小单元。
它包含:
- Assembly Identity
- Manifest
- Metadata
- MSIL Code
- Security Information
- Assembly Header
程序集是构成逻辑功能单元的类型和资源的集合。.NET Framework中的所有类型都必须存在于程序集中;公共语言运行库不支持程序集之外的类型。每次使用Visual Basic . net创建Microsoft Windows®应用程序、Windows服务、类库或其他应用程序时,您都在构建单个程序集。每个程序集都存储为.exe或.dll文件。
来源:https://msdn.microsoft.com/en-us/library/ms973231.aspx#assenamesp_topic4
对于像我这样有Java背景的人来说,希望下面的图表能够阐明概念
程序集就像jar文件(包含多个.class文件)。您的代码可以引用现有的程序集,或者您的代码本身可以作为程序集发布,以供其他代码引用和使用(您可以将其视为Java中的jar文件,可以添加到项目依赖项中)。
最后,程序集是可以在任何安装了CLR的操作系统上运行的编译代码。这就相当于说.class文件或捆绑的jar可以在任何安装了JVM的机器上运行。
在。net中,当我们编译源代码时,会在Visual Studio中生成程序集。程序集由清单和IL(中间语言)两部分组成。清单包含程序集元数据意味着程序集的版本要求、安全标识、组成程序集的所有文件的名称和散列。IL包含类、构造函数、主方法等信息。
用更简单的术语来说:可以由. net运行时环境执行的(预编译的)代码块。. net程序由一个或多个程序集组成。
推荐文章
- 在什么情况下SqlConnection会自动被征召到环境事务范围事务中?
- 用c#解析JSON
- Windows窗体中的标签的换行
- 为什么在c#中使用finally ?
- 为什么不是字符串。空一个常数?
- 为什么我不能在c#中有抽象静态方法?
- Nuget连接尝试失败“无法为源加载服务索引”
- net HttpClient。如何POST字符串值?
- 我如何使一个方法的返回类型泛型?
- 何时处理CancellationTokenSource?
- 如何获取正在执行的程序集版本?
- AutoMapper vs valueinjector
- 为什么控制台不。Writeline,控制台。在Visual Studio Express中编写工作?
- 什么是.NET程序集?
- 字符串不能识别为有效的日期时间“格式dd/MM/yyyy”