ClrFromCSharp_2_2_生成部署打包应用程序
1,在\reps\CSharpFromCSarp\CSharpFromCSarp_2_2,建立新解决方案和解决项目
并且输入以下代码
namespace ClrFromCSharp_2_2 { class Program { static void Main(string[] args) { System.Console.WriteLine("hi"); } } }
2,然后,在工具-命令行-Powshell,打开Powshell并且输入指令
PS C:\reps\ClrFromCSharp\ClrFromCSharp_2_2> csc.exe Program.cs Microsoft(R) Visual C# 编译器 版本 3.4.1-beta4-19610-02 (c4e5d138) 版权所有(C) Microsoft Corporation。保留所有权利。
3,响应文件,响应文件就是包含了/r:…/t…类似的文件。以rsp结尾。默认的文件安装位置为:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
# This file contains command-line options that the C# # command line compiler (CSC) will process as part # of every compilation, unless the "/noconfig" option # is specified. # Reference the common Framework libraries /r:Accessibility.dll /r:Microsoft.CSharp.dll /r:System.Configuration.dll /r:System.Configuration.Install.dll /r:System.Core.dll /r:System.Data.dll /r:System.Data.DataSetExtensions.dll /r:System.Data.Linq.dll /r:System.Data.OracleClient.dll /r:System.Deployment.dll /r:System.Design.dll /r:System.DirectoryServices.dll /r:System.dll /r:System.Drawing.Design.dll /r:System.Drawing.dll /r:System.EnterpriseServices.dll /r:System.Management.dll /r:System.Messaging.dll /r:System.Runtime.Remoting.dll /r:System.Runtime.Serialization.dll /r:System.Runtime.Serialization.Formatters.Soap.dll /r:System.Security.dll /r:System.ServiceModel.dll /r:System.ServiceModel.Web.dll /r:System.ServiceProcess.dll /r:System.Transactions.dll /r:System.Web.dll /r:System.Web.Extensions.Design.dll /r:System.Web.Extensions.dll /r:System.Web.Mobile.dll /r:System.Web.RegularExpressions.dll /r:System.Web.Services.dll /r:System.Windows.Forms.Dll /r:System.Workflow.Activities.dll /r:System.Workflow.ComponentModel.dll /r:System.Workflow.Runtime.dll /r:System.Xml.dll /r:System.Xml.Linq.dll
4,Program.exe文件里面到底有什么?
托管的PE文件由4个部分组成
- PE头
- CLR头
- 元数据----由二进制表构成的数据定义块,常见的有:
- 定义表
| ModuleDef | 总是对模块进行标识的定义项: |
| TypeDef | 模块定义的每个类型在表中的记录项 |
| MethodDef | 方法的记录项 |
| FieldDef | 字段的定义项 |
| ParamDef | 模块定义的参数的记录项 |
| PropertyDef | 属性记录项 |
| EventDef | 事件定义项 |
- 引用表
- 清单表
| AssemblyRef | 模块引用的每个程序集的记项 |
| ModuleRef | 模块引用的每个模块的记录项 |
| TypeRef | 模块引用的每个类型的记录项 |
| MemberRef | 模块引用的每个成员(字段,方法,属性,事件) |
使用 ILDASM.EXE 反编译器来查看元数据表---在视图---显示---元数据。
PS C:\reps\ClrFromCSharp\ClrFromCSharp_2_2> ildasm.exe Program.exe
TypeDef #1 (02000002) ------------------------------------------------------- TypDefName: ClrFromCSharp_2_2.Program (02000002) Flags : [NotPublic] [AutoLayout] [Class] [AnsiClass] [BeforeFieldInit] (00100000) Extends : 01000005 [TypeRef] System.Object Method #1 (06000001) [ENTRYPOINT] ------------------------------------------------------- MethodName: Main (06000001) Flags : [Private] [Static] [HideBySig] [ReuseSlot] (00000091) RVA : 0x00002050 ImplFlags : [IL] [Managed] (00000000) CallCnvntn: [DEFAULT] ReturnType: Void 1 Arguments Argument #1: SZArray String 1 Parameters (1) ParamToken : (08000001) Name : args flags: [none] (00000000) Method #2 (06000002) ------------------------------------------------------- MethodName: .ctor (06000002) Flags : [Public] [HideBySig] [ReuseSlot] [SpecialName] [RTSpecialName] [.ctor] (00001886) RVA : 0x0000205e ImplFlags : [IL] [Managed] (00000000) CallCnvntn: [DEFAULT] hasThis ReturnType: Void No arguments.
程序集---一个或多个类型定义文件或者资源文件的集合。在程序集的所有文件中有一个文件容纳了 清单(MainFest)
清单也是一个元数据表集合。CLR总是先加载清单文件,然后通过清单获取程序集中其他文件的名称
- 程序集定义可重用的类型
- 程序集有版本号标记
- 程序集可以关联安全信息
生成程序集-----以现有的PE文件作为清单的宿组,或者创建单独的PE文件,并且其中只包含清单。
清单元数据表
| AssemblyDef | 如果模块标识的是程序集,则列出
|
| FileDef | 作为程序集一部分的每个PE文件和资源文件在这个表中都有一个记录项。 每个记录项包含
如果只是单独的文件,则无记录 --------程序集必然包含一个主模块文件(后缀,.EXE,.DLL) |
| ManifestResourceDef | 作为程序集一部分的每个资源在表中的记录项
|
| ExportedTypesDef | 从程序集中所有模块导出的所有public类型在这个表中都有一个记录项
|
指定以下命令行开关,csc编译器将生成程序集:/t:exe,/t:winexe;/t:appcontainerexe;/t:library或/t:winmdobj
另外,csc还支持 /t:module开关,这个开关只是编译器生成一个不包含清单的元数据表格的PE文件。这样生成的文件是一个.dll PE文件,CLR想要访问其中的任何类型,必须先将该类型添加到一个程序集中去。使用/t:module 开关,默认扩展是.netmodule
可以使用/addmodule 将模块添加到程序集。
5,将模块合并成程序集
文件1:Ch02-3-FUT.cs
using System; public sealed class AFrequentlyUsedType { public AFrequentlyUsedType() { Console.WriteLine("A frequently used type was constructed."); } }
文件2:Ch02-3-RUT.cs
using System; public sealed class ARarelyUsedType { public ARarelyUsedType() { Console.WriteLine("A rarely used type was constructed."); } }
文件3:Ch02-3-AssemblyVersionInfo.cs//程序集版本信息
using System.Reflection; // FileDescription version information: [assembly: AssemblyTitle("JeffTypes.dll")] // Comments version information: [assembly: AssemblyDescription("This assembly contains Jeff's types")] // CompanyName version information: [assembly: AssemblyCompany("Wintellect")] // ProductName version information: [assembly: AssemblyProduct("Wintellect (R) Jeff's Type Library")] // LegalCopyright version information: [assembly: AssemblyCopyright("Copyright (c) Wintellect 2010")] // LegalTrademarks version information: [assembly:AssemblyTrademark("JeffTypes is a registered trademark of Wintellect")] // AssemblyVersion version information: [assembly: AssemblyVersion("3.0.0.0")] // FILEVERSION/FileVersion version information: [assembly: AssemblyFileVersion("1.0.0.0")] // PRODUCTVERSION/ProductVersion version information: [assembly: AssemblyInformationalVersion("2.0.0.0")] // Set the Language field (discussed later in the "Culture" section) [assembly:AssemblyCulture("")]
然后进行文件的生成 先进入Clr via c# 文件夹:
方法1:
csc /t:module /debug:full /out:Ch02-3-RUT.netmodule Ch02-3-RUT.cs csc /t:library /debug:full /out:Ch02-3-MultiFileLibrary.dll /addmodule:Ch02-3-RUT.netmodule Ch02-3-FUT.cs Ch02-3-AssemblyVersionInfo.cs
方法2:需要将所有文件所有文件移动到bin\debug文件夹下,不然会找不到FUt这个文件。
csc /t:module /debug:full /out:Ch02-3-RUT.netmodule Ch02-3-RUT.cs csc /t:module /debug:full /out:Ch02-3-FUT.netmodule Ch02-3-FUT.cs Ch02-3-AssemblyVersionInfo.cs al /out:Ch02-3-MultiFileLibrary.dll /t:library Ch02-3-RUT.netmodule Ch02-3-FUT.netmodule
这是生成的文件:
这是 RUT的元数据
===========================================================
ScopeName : Ch02-3-RUT.netmodule
MVID : {47D0E682-537C-4CD3-94F1-74CC1A54613C}
===========================================================
Global functions
-------------------------------------------------------
Global fields
-------------------------------------------------------
Global MemberRefs
-------------------------------------------------------
TypeDef #1 (02000002)
-------------------------------------------------------
TypDefName: ARarelyUsedType (02000002)
Flags : [Public] [AutoLayout] [Class] [Sealed] [AnsiClass] [BeforeFieldInit] (00100101)
Extends : 01000001 [TypeRef] System.Object
Method #1 (06000001)
-------------------------------------------------------
MethodName: .ctor (06000001)
Flags : [Public] [HideBySig] [ReuseSlot] [SpecialName] [RTSpecialName] [.ctor] (00001886)
RVA : 0x00002050
ImplFlags : [IL] [Managed] (00000000)
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
No arguments.
TypeRef #1 (01000001)
-------------------------------------------------------
Token: 0x01000001
ResolutionScope: 0x23000001
TypeRefName: System.Object
MemberRef #1 (0a000001)
-------------------------------------------------------
Member: (0a000001) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
No arguments.
TypeRef #2 (01000002)
-------------------------------------------------------
Token: 0x01000002
ResolutionScope: 0x23000001
TypeRefName: System.Console
MemberRef #1 (0a000002)
-------------------------------------------------------
Member: (0a000002) WriteLine:
CallCnvntn: [DEFAULT]
ReturnType: Void
1 Arguments
Argument #1: String
AssemblyRef #1 (23000001)
-------------------------------------------------------
Token: 0x23000001
Public Key or Token: b7 7a 5c 56 19 34 e0 89
Name: mscorlib
Version: 4.0.0.0
Major Version: 0x00000004
Minor Version: 0x00000000
Build Number: 0x00000000
Revision Number: 0x00000000
Locale: <null>
HashValue Blob:
Flags: [none] (00000000)
User Strings
-------------------------------------------------------
70000001 : (35) L"A rarely used type was constructed."
Coff symbol name overhead: 0
===========================================================
===========================================================
===========================================================
这是FUT的元数据
ScopeName : Ch02-3-FUT.netmodule
MVID : {E6088791-AAB7-4FA3-88BB-AEEB8CE9E21B}
===========================================================
Global functions
-------------------------------------------------------
Global fields
-------------------------------------------------------
Global MemberRefs
-------------------------------------------------------
TypeDef #1 (02000002)
-------------------------------------------------------
TypDefName: AFrequentlyUsedType (02000002)
Flags : [Public] [AutoLayout] [Class] [Sealed] [AnsiClass] [BeforeFieldInit] (00100101)
Extends : 0100000B [TypeRef] System.Object
Method #1 (06000001)
-------------------------------------------------------
MethodName: .ctor (06000001)
Flags : [Public] [HideBySig] [ReuseSlot] [SpecialName] [RTSpecialName] [.ctor] (00001886)
RVA : 0x00002050
ImplFlags : [IL] [Managed] (00000000)
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
No arguments.
TypeRef #1 (01000001)
-------------------------------------------------------
Token: 0x01000001
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyTitleAttribute
MemberRef #1 (0a000001)
-------------------------------------------------------
Member: (0a000001) .ctor://类型有一个构造函数。
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #2 (01000002)
-------------------------------------------------------
Token: 0x01000002
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyDescriptionAttribute
MemberRef #1 (0a000002)
-------------------------------------------------------
Member: (0a000002) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #3 (01000003)
-------------------------------------------------------
Token: 0x01000003
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyCompanyAttribute
MemberRef #1 (0a000003)
-------------------------------------------------------
Member: (0a000003) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #4 (01000004)
-------------------------------------------------------
Token: 0x01000004
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyProductAttribute
MemberRef #1 (0a000004)
-------------------------------------------------------
Member: (0a000004) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #5 (01000005)
-------------------------------------------------------
Token: 0x01000005
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyCopyrightAttribute
MemberRef #1 (0a000005)
-------------------------------------------------------
Member: (0a000005) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #6 (01000006)
-------------------------------------------------------
Token: 0x01000006
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyTrademarkAttribute
MemberRef #1 (0a000006)
-------------------------------------------------------
Member: (0a000006) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #7 (01000007)
-------------------------------------------------------
Token: 0x01000007
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyVersionAttribute
MemberRef #1 (0a000007)
-------------------------------------------------------
Member: (0a000007) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #8 (01000008)
-------------------------------------------------------
Token: 0x01000008
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyFileVersionAttribute
MemberRef #1 (0a000008)
-------------------------------------------------------
Member: (0a000008) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #9 (01000009)
-------------------------------------------------------
Token: 0x01000009
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyInformationalVersionAttribute
MemberRef #1 (0a000009)
-------------------------------------------------------
Member: (0a000009) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #10 (0100000a)
-------------------------------------------------------
Token: 0x0100000a
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyCultureAttribute
MemberRef #1 (0a00000a)
-------------------------------------------------------
Member: (0a00000a) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #11 (0100000b)
-------------------------------------------------------
Token: 0x0100000b
ResolutionScope: 0x23000001
TypeRefName: System.Object
MemberRef #1 (0a00000b)
-------------------------------------------------------
Member: (0a00000b) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
No arguments.
TypeRef #12 (0100000c)
-------------------------------------------------------
Token: 0x0100000c
ResolutionScope: 0x23000001
TypeRefName: System.Console
MemberRef #1 (0a00000c)
-------------------------------------------------------
Member: (0a00000c) WriteLine:
CallCnvntn: [DEFAULT]
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #13 (0100000d)
-------------------------------------------------------
Token: 0x0100000d
ResolutionScope: 0x23000001
TypeRefName: System.Runtime.CompilerServices.AssemblyAttributesGoHere
CustomAttribute #1 (0c000001)
-------------------------------------------------------
CustomAttribute Type: 0a000001
CustomAttributeName: System.Reflection.AssemblyTitleAttribute :: instance void .ctor(class System.String)
Length: 18
Value : 01 00 0d 4a 65 66 66 54 79 70 65 73 2e 64 6c 6c > JeffTypes.dll<
: 00 00 > <
ctor args: ("JeffTypes.dll")//创建了属性对象并且初始化
CustomAttribute #2 (0c000002)
-------------------------------------------------------
CustomAttribute Type: 0a000002
CustomAttributeName: System.Reflection.AssemblyDescriptionAttribute :: instance void .ctor(class System.String)
Length: 40
Value : 01 00 23 54 68 69 73 20 61 73 73 65 6d 62 6c 79 > #This assembly<
: 20 63 6f 6e 74 61 69 6e 73 20 4a 65 66 66 27 73 > contains Jeff's<
: 20 74 79 70 65 73 00 00 > types <
ctor args: ("This assembly contains Jeff's types")
CustomAttribute #3 (0c000003)
-------------------------------------------------------
CustomAttribute Type: 0a000003
CustomAttributeName: System.Reflection.AssemblyCompanyAttribute :: instance void .ctor(class System.String)
Length: 15
Value : 01 00 0a 57 69 6e 74 65 6c 6c 65 63 74 00 00 > Wintellect <
ctor args: ("Wintellect")
CustomAttribute #4 (0c000004)
-------------------------------------------------------
CustomAttribute Type: 0a000004
CustomAttributeName: System.Reflection.AssemblyProductAttribute :: instance void .ctor(class System.String)
Length: 39
Value : 01 00 22 57 69 6e 74 65 6c 6c 65 63 74 20 28 52 > "Wintellect (R<
: 29 20 4a 65 66 66 27 73 20 54 79 70 65 20 4c 69 >) Jeff's Type Li<
: 62 72 61 72 79 00 00 >brary <
ctor args: ("Wintellect (R) Jeff's Type Library")
CustomAttribute #5 (0c000005)
-------------------------------------------------------
CustomAttribute Type: 0a000005
CustomAttributeName: System.Reflection.AssemblyCopyrightAttribute :: instance void .ctor(class System.String)
Length: 34
Value : 01 00 1d 43 6f 70 79 72 69 67 68 74 20 28 63 29 > Copyright (c)<
: 20 57 69 6e 74 65 6c 6c 65 63 74 20 32 30 31 30 > Wintellect 2010<
: 00 00 > <
ctor args: ("Copyright (c) Wintellect 2010")
CustomAttribute #6 (0c000006)
-------------------------------------------------------
CustomAttribute Type: 0a000006
CustomAttributeName: System.Reflection.AssemblyTrademarkAttribute :: instance void .ctor(class System.String)
Length: 54
Value : 01 00 31 4a 65 66 66 54 79 70 65 73 20 69 73 20 > 1JeffTypes is <
: 61 20 72 65 67 69 73 74 65 72 65 64 20 74 72 61 >a registered tra<
: 64 65 6d 61 72 6b 20 6f 66 20 57 69 6e 74 65 6c >demark of Wintel<
: 6c 65 63 74 00 00 >lect <
ctor args: ("JeffTypes is a registered trademark of Wintellect")
CustomAttribute #7 (0c000007)
-------------------------------------------------------
CustomAttribute Type: 0a000007
CustomAttributeName: System.Reflection.AssemblyVersionAttribute :: instance void .ctor(class System.String)
Length: 12
Value : 01 00 07 33 2e 30 2e 30 2e 30 00 00 > 3.0.0.0 <
ctor args: ("3.0.0.0")
CustomAttribute #8 (0c000008)
-------------------------------------------------------
CustomAttribute Type: 0a000008
CustomAttributeName: System.Reflection.AssemblyFileVersionAttribute :: instance void .ctor(class System.String)
Length: 12
Value : 01 00 07 31 2e 30 2e 30 2e 30 00 00 > 1.0.0.0 <
ctor args: ("1.0.0.0")
CustomAttribute #9 (0c000009)
-------------------------------------------------------
CustomAttribute Type: 0a000009
CustomAttributeName: System.Reflection.AssemblyInformationalVersionAttribute :: instance void .ctor(class System.String)
Length: 12
Value : 01 00 07 32 2e 30 2e 30 2e 30 00 00 > 2.0.0.0 <
ctor args: ("2.0.0.0")
CustomAttribute #10 (0c00000a)
-------------------------------------------------------
CustomAttribute Type: 0a00000a
CustomAttributeName: System.Reflection.AssemblyCultureAttribute :: instance void .ctor(class System.String)
Length: 5
Value : 01 00 00 00 00 > <
ctor args: ("")
AssemblyRef #1 (23000001)
-------------------------------------------------------
Token: 0x23000001
Public Key or Token: b7 7a 5c 56 19 34 e0 89
Name: mscorlib
Version: 4.0.0.0
Major Version: 0x00000004
Minor Version: 0x00000000
Build Number: 0x00000000
Revision Number: 0x00000000
Locale: <null>
HashValue Blob:
Flags: [none] (00000000)
User Strings
-------------------------------------------------------
70000001 : (39) L"A frequently used type was constructed."
Coff symbol name overhead: 0
===========================================================
===========================================================
===========================================================
注意其中的 属性对应的东西。 生成了属性的方法和属性的CustomAttribute。
下面是合成的Ch02-3-MultiFileLibrary.dll 的文件
===========================================================
ScopeName : Ch02-3-MultiFileLibrary.dll
MVID : {31DACE10-F746-4EA0-8641-97856BBC0726}
===========================================================
Global functions
-------------------------------------------------------
Global fields
-------------------------------------------------------
Global MemberRefs
-------------------------------------------------------
TypeRef #1 (01000001)
-------------------------------------------------------
Token: 0x01000001
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyTitleAttribute
MemberRef #1 (0a000001)
-------------------------------------------------------
Member: (0a000001) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #2 (01000002)
-------------------------------------------------------
Token: 0x01000002
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyDescriptionAttribute
MemberRef #1 (0a000002)
-------------------------------------------------------
Member: (0a000002) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #3 (01000003)
-------------------------------------------------------
Token: 0x01000003
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyCompanyAttribute
MemberRef #1 (0a000003)
-------------------------------------------------------
Member: (0a000003) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #4 (01000004)
-------------------------------------------------------
Token: 0x01000004
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyProductAttribute
MemberRef #1 (0a000004)
-------------------------------------------------------
Member: (0a000004) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #5 (01000005)
-------------------------------------------------------
Token: 0x01000005
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyCopyrightAttribute
MemberRef #1 (0a000005)
-------------------------------------------------------
Member: (0a000005) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #6 (01000006)
-------------------------------------------------------
Token: 0x01000006
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyTrademarkAttribute
MemberRef #1 (0a000006)
-------------------------------------------------------
Member: (0a000006) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #7 (01000007)
-------------------------------------------------------
Token: 0x01000007
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyFileVersionAttribute
MemberRef #1 (0a000007)
-------------------------------------------------------
Member: (0a000007) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
TypeRef #8 (01000008)
-------------------------------------------------------
Token: 0x01000008
ResolutionScope: 0x23000001
TypeRefName: System.Reflection.AssemblyInformationalVersionAttribute
MemberRef #1 (0a000008)
-------------------------------------------------------
Member: (0a000008) .ctor:
CallCnvntn: [DEFAULT]
hasThis
ReturnType: Void
1 Arguments
Argument #1: String
Assembly//程序集信息
-------------------------------------------------------
Token: 0x20000001
Name : Ch02-3-MultiFileLibrary
Public Key :
Hash Algorithm : 0x00008004
Version: 3.0.0.0
Major Version: 0x00000003
Minor Version: 0x00000000
Build Number: 0x00000000
Revision Number: 0x00000000
Locale: <null>
Flags : [none] (00000000)
CustomAttribute #1 (0c000001)//嵌入的程序集中属性信息。
-------------------------------------------------------
CustomAttribute Type: 0a000001
CustomAttributeName: System.Reflection.AssemblyTitleAttribute :: instance void .ctor(class System.String)
Length: 18
Value : 01 00 0d 4a 65 66 66 54 79 70 65 73 2e 64 6c 6c > JeffTypes.dll<
: 00 00 > <
ctor args: ("JeffTypes.dll")
CustomAttribute #2 (0c000002)
-------------------------------------------------------
CustomAttribute Type: 0a000002
CustomAttributeName: System.Reflection.AssemblyDescriptionAttribute :: instance void .ctor(class System.String)
Length: 40
Value : 01 00 23 54 68 69 73 20 61 73 73 65 6d 62 6c 79 > #This assembly<
: 20 63 6f 6e 74 61 69 6e 73 20 4a 65 66 66 27 73 > contains Jeff's<
: 20 74 79 70 65 73 00 00 > types <
ctor args: ("This assembly contains Jeff's types")
CustomAttribute #3 (0c000003)
-------------------------------------------------------
CustomAttribute Type: 0a000003
CustomAttributeName: System.Reflection.AssemblyCompanyAttribute :: instance void .ctor(class System.String)
Length: 15
Value : 01 00 0a 57 69 6e 74 65 6c 6c 65 63 74 00 00 > Wintellect <
ctor args: ("Wintellect")
CustomAttribute #4 (0c000004)
-------------------------------------------------------
CustomAttribute Type: 0a000004
CustomAttributeName: System.Reflection.AssemblyProductAttribute :: instance void .ctor(class System.String)
Length: 39
Value : 01 00 22 57 69 6e 74 65 6c 6c 65 63 74 20 28 52 > "Wintellect (R<
: 29 20 4a 65 66 66 27 73 20 54 79 70 65 20 4c 69 >) Jeff's Type Li<
: 62 72 61 72 79 00 00 >brary <
ctor args: ("Wintellect (R) Jeff's Type Library")
CustomAttribute #5 (0c000005)
-------------------------------------------------------
CustomAttribute Type: 0a000005
CustomAttributeName: System.Reflection.AssemblyCopyrightAttribute :: instance void .ctor(class System.String)
Length: 34
Value : 01 00 1d 43 6f 70 79 72 69 67 68 74 20 28 63 29 > Copyright (c)<
: 20 57 69 6e 74 65 6c 6c 65 63 74 20 32 30 31 30 > Wintellect 2010<
: 00 00 > <
ctor args: ("Copyright (c) Wintellect 2010")
CustomAttribute #6 (0c000006)
-------------------------------------------------------
CustomAttribute Type: 0a000006
CustomAttributeName: System.Reflection.AssemblyTrademarkAttribute :: instance void .ctor(class System.String)
Length: 54
Value : 01 00 31 4a 65 66 66 54 79 70 65 73 20 69 73 20 > 1JeffTypes is <
: 61 20 72 65 67 69 73 74 65 72 65 64 20 74 72 61 >a registered tra<
: 64 65 6d 61 72 6b 20 6f 66 20 57 69 6e 74 65 6c >demark of Wintel<
: 6c 65 63 74 00 00 >lect <
ctor args: ("JeffTypes is a registered trademark of Wintellect")
CustomAttribute #7 (0c000007)
-------------------------------------------------------
CustomAttribute Type: 0a000007
CustomAttributeName: System.Reflection.AssemblyFileVersionAttribute :: instance void .ctor(class System.String)
Length: 12
Value : 01 00 07 31 2e 30 2e 30 2e 30 00 00 > 1.0.0.0 <
ctor args: ("1.0.0.0")
CustomAttribute #8 (0c000008)
-------------------------------------------------------
CustomAttribute Type: 0a000008
CustomAttributeName: System.Reflection.AssemblyInformationalVersionAttribute :: instance void .ctor(class System.String)
Length: 12
Value : 01 00 07 32 2e 30 2e 30 2e 30 00 00 > 2.0.0.0 <
ctor args: ("2.0.0.0")
AssemblyRef #1 (23000001)//相关程序集
-------------------------------------------------------
Token: 0x23000001
Public Key or Token: b7 7a 5c 56 19 34 e0 89
Name: mscorlib
Version: 4.0.0.0
Major Version: 0x00000004
Minor Version: 0x00000000
Build Number: 0x00000000
Revision Number: 0x00000000
Locale: <null>
HashValue Blob:
Flags: [none] (00000000)
File #1 (26000001)//相关文件
-------------------------------------------------------
Token: 0x26000001
Name : Ch02-3-RUT.netmodule
HashValue Blob : 5b fa 12 3e a9 d0 b0 da fa 38 30 e9 ca 49 21 c0 1b c1 bc bb
Flags : [ContainsMetaData] (00000000)
File #2 (26000002)
-------------------------------------------------------
Token: 0x26000002
Name : Ch02-3-FUT.netmodule
HashValue Blob : 72 3c cc 7d 75 d1 0a 78 df 09 a3 a8 71 3a e9 68 fe bb 0b 5e
Flags : [ContainsMetaData] (00000000)
ExportedType #1 (27000001)//输出的类型
-------------------------------------------------------
Token: 0x27000001
Name: ARarelyUsedType
Implementation token: 0x26000001
TypeDef token: 0x02000002
Flags : [Public] [AutoLayout] [Class] [Sealed] [AnsiClass] [BeforeFieldInit] (00100101)
ExportedType #2 (27000002)
-------------------------------------------------------
Token: 0x27000002
Name: AFrequentlyUsedType
Implementation token: 0x26000002
TypeDef token: 0x02000002
Flags : [Public] [AutoLayout] [Class] [Sealed] [AnsiClass] [BeforeFieldInit] (00100101)
User Strings
-------------------------------------------------------
70000001 : ( 1) L" "
Coff symbol name overhead: 0
===========================================================
===========================================================
===========================================================
6,在VS中引用程序集
想引用程序集中的解决方案,可以右击项目,然后在引用里面添加
- 程序集:添加程序集
- 项目:解决方案,在同一个解决方案的一个项目引用不同项目的方法
- COM:允许托管代码访问非托管的COM对象
- 浏览:自定义插入程序集。
7,为程序集添加资源文件:
AL.EXE支持嵌入资源文件---/embed[resource] /link[resource]
csc.exe 支持嵌入资源文件---/resource ---linkresource
8,程序集信息
1,程序集信息输入方式:
- 在项目上属性,程序集里面可以看到信息
![image image]()
- 我的git地址-----CLR from c# 配套编程文件:在VS中下载即可。
- 我的git教程----查看我之前的git博文
using System.Reflection; // FileDescription version information: [assembly: AssemblyTitle("JeffTypes.dll")] // Comments version information: [assembly: AssemblyDescription("This assembly contains Jeff's types")] // CompanyName version information: [assembly: AssemblyCompany("Wintellect")] // ProductName version information: [assembly: AssemblyProduct("Wintellect (R) Jeff's Type Library")] // LegalCopyright version information: [assembly: AssemblyCopyright("Copyright (c) Wintellect 2010")] // LegalTrademarks version information: [assembly:AssemblyTrademark("JeffTypes is a registered trademark of Wintellect")] // AssemblyVersion version information: [assembly: AssemblyVersion("3.0.0.0")] // FILEVERSION/FileVersion version information: [assembly: AssemblyFileVersion("1.0.0.0")] // PRODUCTVERSION/ProductVersion version information: [assembly: AssemblyInformationalVersion("2.0.0.0")] // Set the Language field (discussed later in the "Culture" section) [assembly:AssemblyCulture("")]




浙公网安备 33010602011771号