Al.exe(程序集链接器)Al.exe (Assembly Linker)

程序集链接器从一个或多个文件(这些文件可以是模块或资源文件)生成一个具有程序集清单的文件。The Assembly Linker generates a file that has an assembly manifest from one or more files that are either modules or resource files. 模块是不含程序集清单的中间语言 (IL) 文件。A module is an intermediate language (IL) file that does not have an assembly manifest.

备注

从 Visual Studio 2008 开始,C# 和 Visual Basic 编译器都自动将 Win32 清单嵌入到程序集中。Starting with Visual Studio 2008, both the C# and Visual Basic compilers automatically embed a Win32 manifest into the assembly. 有关详细信息,请参阅 -win32manifest(C# 编译器选项)For more information, see -win32manifest (C# Compiler Options).

此工具会自动随 Visual Studio 一起安装。This tool is automatically installed with Visual Studio. 若要运行此工具,请使用 Visual Studio 开发人员命令提示(或 Windows 7 中的 Visual Studio 命令提示)。To run the tool, use the Developer Command Prompt for Visual Studio (or the Visual Studio Command Prompt in Windows 7). 有关详细信息,请参阅命令提示For more information, see Command Prompts.

在命令提示符处,键入以下内容:At the command prompt, type the following:

语法Syntax

al sources options

参数Parameters

你可以指定以下一个或多个 sourcesYou can specify one or more of the following sources.

Source 描述Description
file[,target]file[,target] file(模块)的内容复制到 target 指定的文件名。Copies the contents of file (a module) to the file name specified by target. 复制后,Al.exe 将 target 编译为程序集。After copying, Al.exe compiles target into an assembly.
/embed[resource]: file[,name[,private]]/embed[resource]: file[,name[,private]] file 指定的资源嵌入到包含程序集清单的映像中;Al.exe 将 file 的内容复制到可移植的可执行 (PE) 映像中。Embeds the resource specified by file in the image that contains the assembly manifest; Al.exe copies the contents of file into the portable executable (PE) image.

name 参数是资源的内部标识符。The name parameter is an internal identifier for the resource. 默认情况下,资源在程序集中是公共的(对于其他程序集可见)。By default, resources are public in the assembly (visible to other assemblies). 指定 private 会使该资源对于其他程序集不可见。Specifying private makes the resource not visible to other assemblies.

例如,如果 file 是由资源文件生成器 (Resgen.exe) 创建的或在开发环境中创建的 .NET Framework 资源文件,则可使用 System.Resources 中的成员来访问它。If file is a .NET Framework resource file created, for example, by the Resource File Generator (Resgen.exe) or in the development environment, it can be accessed with members in the System.Resources. 有关详细信息,请参阅 ResourceManagerFor more information, see ResourceManager. 对于所有其他资源,请使用 Assembly 中的 GetManifestResource* 方法在运行时访问此资源。For all other resources, use the GetManifestResource* methods in the Assembly to access the resource at run time.

如果只将资源文件传递给 Al.exe,则输出文件为附属资源程序集。If only resource files are passed to Al.exe, the output file is a satellite resource assembly.
/link[resource]: file[,name[,target[,private]]]/link[resource]: file[,name[,target[,private]]] 将资源文件链接到程序集。Links a resource file to an assembly. file 指定的资源成为程序集的组成部分;不复制该文件。The resource specified by file becomes part of the assembly; the file is not copied. file 参数可以是任何文件格式。The file parameter can be in any file format. 例如,可以指定本机 DLL 作为 file 参数。For example, you can specify a native DLL as the file parameter. 这将使本机 DLL 成为此程序集的组成部分,从而可将它安装到全局程序集缓存中,并且可从该程序集中的托管代码访问它。This will make the native DLL part of the assembly so that it can be installed into the global assembly cache and accessed from managed code in the assembly. 也可以通过使用 /linkresource 编译器选项实现该目的。You can also do this by using the /linkresource compiler option. 有关详细信息,请参阅 -linkresource(C# 编译器选项)For more information, see -linkresource (C# Compiler Options).

name 参数是资源的内部标识符。The name parameter is an internal identifier for the resource. target 参数指定 Al.exe 将 file 复制到其中的路径和文件名。The target parameter specifies a path and file name into which Al.exe copies the file. 复制后,Al.exe 将 target 编译为程序集。After copying, Al.exe compiles target into an assembly. 默认情况下,资源在程序集中是公共的(对于其他程序集可见)。By default, resources are public in the assembly (visible to other assemblies). 指定 private 会使该资源对于其他程序集不可见。Specifying private makes the resource not visible to other assemblies.

例如,如果 file 是由资源文件生成器 (Resgen.exe) 创建的或在开发环境中创建的 .NET Framework 资源文件,则可使用 System.Resources 命名空间中的成员来访问它。If file is a .NET Framework resource file created, for example, by the Resource File Generator (Resgen.exe) or in the development environment, it can be accessed with members in the System.Resources namespace. 有关详细信息,请参阅 ResourceManagerFor more information, see ResourceManager. 对于所有其他资源,请使用 Assembly 类中的 GetManifestResource* 方法在运行时访问资源。For all other resources, use the GetManifestResource* methods in the Assembly class to access the resource at run time.

如果只将资源文件传递给 Al.exe,则输出文件为附属资源程序集。If only resource files are passed to Al.exe, the output file is a satellite resource assembly.

可以指定以下 options;必须指定 /outYou can specify the following options; you must specify /out.

选项Option 描述Description
/algid: id/algid: id 指定一种算法来对多文件程序集中的所有文件(包含程序集清单的文件除外)进行哈希处理。Specifies an algorithm to hash all files in a multifile assembly except the file that contains the assembly manifest. 默认算法是 CALG_SHA1。The default algorithm is CALG_SHA1. 有关其他算法,请参见平台 SDK 文档中的 ALG_ID。See ALG_ID in the Platform SDK documentation for other algorithms. 对于 .NET Framework 的第一版,只有 CALG_SHA1 和 CALG_MD5 是有效的。For the first release of the .NET Framework, only CALG_SHA1 and CALG_MD5 are valid.

哈希值存储在程序集清单的文件表中。The hash values are stored in the file table of the assembly manifest. 在安装和加载时,会对照相应的哈希值检查程序集文件。At installation and load time, the assembly's files are checked against their hashes.

还可以将此选项指定为任何模块的源代码中的自定义特性 (AssemblyAlgorithmIdAttribute)。You can also specify this option as a custom attribute (AssemblyAlgorithmIdAttribute) in the source code for any module.
/base[address]: addr/base[address]: addr 指定一个地址,运行时在用户计算机上在该地址加载 DLL。Specifies the address at which a DLL will be loaded on the user's computer at run time. 如果指定 DLL 的基址,而不是让操作系统在进程空间内重新定位 DLL,则应用程序的加载速度会更快。Applications load faster if you specify the base address of the DLLs, instead of letting the operating system relocate the DLLs in the process space.
/bugreport: filename/bugreport: filename 创建包含有关报告 Bug 的信息的文件 (filename)。Creates a file (filename) that contains information for reporting bugs.
/comp[any]: text/comp[any]: text 为程序集中的“公司”字段指定字符串。Specifies a string for the Company field in the assembly. 如果 text 包含空格,则将字符串放置在双引号 (" ") 中。Place the string in double quotation marks (" ") if text contains a space. 此字符串是程序集上的自定义特性,可以使用反射进行查看。This string is a custom attribute on the assembly and is available for viewing with reflection.

如果不指定 /win32res,则 text 会在文件资源管理器中显示为该文件的 Company 属性。If you do not specify /win32res, text appears in File Explorer as the Company property for the file. 如果指定 /win32res,则所指定资源文件中的公司信息将在文件资源管理器中显示为 Company 属性。If you specify /win32res, the company information in the specified resource file appears as the Company property in File Explorer.

如果文本是空字符串 (""),则 Win32 Company 资源会显示为一个空格。If text is an empty string (""), the Win32 Company resource appears as a single space.

如果指定 /win32res,则 /company 将不会影响 Win32 资源信息。If you specify /win32res, /company will not affect the Win32 resource information.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyCompanyAttribute)。You can also specify this option as a custom attribute (AssemblyCompanyAttribute) in the source code for any MSIL module.
/config[uration]: text/config[uration]: text 为程序集中的“配置”字段指定字符串。Specifies a string for the Configuration field in the assembly. 如果 text 包含空格,则将字符串放置在双引号 (" ") 中。Place the string in double quotation marks (" ") if text contains a space. 此字符串是程序集上的自定义特性,可以使用反射进行查看。This string is a custom attribute on the assembly and is available for viewing with reflection.

如果文本是空字符串,则 Win32“配置”资源将显示为一个空格。If text is an empty string, the Win32 Configuration resource appears as a single space.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyConfigurationAttribute)。You can also specify this option as a custom attribute (AssemblyConfigurationAttribute) in the source code for any MSIL module.
/copy[right]: text/copy[right]: text 为程序集中的“版权”字段指定字符串。Specifies a string for the Copyright field in the assembly. 如果 text 包含空格,则将字符串放置在双引号 (" ") 中。Place the string in double quotation marks (" ") if text contains a space. 此字符串是程序集上的自定义特性,可以使用反射进行查看。This string is a custom attribute on the assembly and is available for viewing with reflection.

如果不指定 /win32res,则 /copyright 在文件资源管理器中将显示为 Win32“版权”资源。If you do not specify /win32res, /copyright appears in File Explorer as the Win32 Copyright resource.

如果文本是空字符串,则 Win32 Copyright 资源将显示为一个空格。If text is an empty string, the Win32 Copyright resource appears as a single space.

如果指定 /win32res,则 /copyright 将不会影响 Win32 资源信息。If you specify /win32res, /copyright will not affect the Win32 resource information.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyCopyrightAttribute)。You can also specify this option as a custom attribute (AssemblyCopyrightAttribute) in the source code for any MSIL module.
/c[ulture]: text/c[ulture]: text 指定要与程序集关联的区域性字符串。Specifies the culture string to associate with the assembly. 区域性的有效值是名为“Tags for the Identification of Languages”的 Internet Requests for Comments (RFC) 文档 1766 定义的那些值。Valid values for cultures are those defined by the Internet Requests for Comments (RFC) document 1766 titled "Tags for the Identification of Languages."

如果 text 包含空格,则将字符串放置在双引号 (" ") 中。Place the string in double quotation marks (" ") if text contains a space. 没有默认的区域性字符串。There is no default culture string. 使用反射可以查看此字符串。This string is available for viewing with reflection.

有关有效的 text 字符串的信息,请参见 CultureInfoFor information about valid text strings, see the CultureInfo.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyCultureAttribute)。You can also specify this option as a custom attribute (AssemblyCultureAttribute) in the source code for any MSIL module.
/delay[sign][+|-]/delay[sign][+|-] 指定程序集是完全签名的还是部分签名的。Specifies whether the assembly will be fully or partially signed. 如果需要完全签名的程序集,请使用 /delaysign-Use /delaysign- if you want a fully signed assembly. 如果仅需要将公钥包含在程序集中,则使用 /delaysign+Use /delaysign+ if you only want to include the public key in the assembly.

请求完全签名的程序集时,Al.exe 会对包含清单(程序集元数据)的文件进行哈希处理,并使用私钥对哈希进行签名。When you request a fully signed assembly, Al.exe hashes the file that contains the manifest (assembly metadata) and signs that hash with the private key. 产生的数字签名存储在包含清单的文件中。The resulting digital signature is stored in the file that contains the manifest. 在对程序集延迟签名时,Al.exe 不会计算和存储签名,而只是在文件中保留空间以便稍后可添加该签名。When an assembly is delay signed, Al.exe does not compute and store the signature, but just reserves space in the file so the signature can be added later.

默认值为 /delaysign-The default is /delaysign-.

除非与 /keyfile/keyname 一同使用,否则 /delaysign 选项将不起作用。The /delaysign option has no effect unless used with /keyfile or /keyname.

例如,使用 /delaysign+ 可允许测试人员将程序集放入全局缓存中。For example, using /delaysign+ enables a tester to put the assembly in the global cache. 测试完成后,可以通过将私钥包含在程序集中来对程序集进行完全签名。After testing, you can fully sign the assembly by including the private key in the assembly.

注意:使用 Gacutil.exe(全局程序集缓存工具)将延迟签名的程序集放入全局缓存之前,请使用 Sn.exe(强名称工具)来注册该程序集以跳过验证 。Note: Before using the Gacutil.exe (Global Assembly Cache Tool) to put a delay-signed assembly into the global cache, use the Sn.exe (Strong Name Tool) to register the assembly for verification skipping. 例如 Sn.exe –Vr delaySignedAssemblyFor example, Sn.exe –Vr delaySignedAssembly. 仅将它用于开发。Use this only for development.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyDelaySignAttribute)。You can also specify this option as a custom attribute (AssemblyDelaySignAttribute) in the source code for any MSIL module.
/descr[iption]: text/descr[iption]: text 为程序集中的 Description 字段指定字符串。Specifies a string for the Description field in the assembly. 如果 text 包含空格,则将字符串放置在双引号 (" ") 中。Place the string in double quotation marks (" ") if text contains a space. 此字符串是程序集上的自定义特性,可以使用反射进行查看。This string is a custom attribute on the assembly and is available for viewing with reflection.

如果不指定 /win32res,则 /description 在文件资源管理器中将显示为 Win32“注释”资源。If you do not specify /win32res, /description appears in File Explorer as the Win32 Comments resource.

如果文本是空字符串,则 Win32“注释”资源将显示为一个空格。If text is an empty string, the Win32 Comments resource appears as a single space.

如果指定 /win32res,则 /description 将不会影响 Win32 资源信息。If you specify /win32res, /description will not affect the Win32 resource information.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (Description)。You can also specify this option as a custom attribute (Description) in the source code for any MSIL module.
/e[vidence]: file/e[vidence]: file 使用 Security.Evidence 的资源名将 file 嵌入程序集中。Embeds file in the assembly with the resource name of Security.Evidence.

不能对常规资源使用 Security.Evidence。You cannot use Security.Evidence for regular resources.
/fileversion: version/fileversion: version 为程序集中的“文件版本”字段指定字符串。Specifies a string for the File Version field in the assembly. 此字符串是程序集上的自定义特性,可以使用反射进行查看。This string is a custom attribute on the assembly and is available for viewing with reflection.

如果不指定 /win32res,则 /fileversion 将用作 Win32“文件版本”资源。If you do not specify /win32res, /fileversion will be used as the Win32 File Version resource. 如果不指定 /fileversion,则 Win32“文件版本”资源将由 Win32“程序集版本”资源填充。If you do not specify /fileversion, the Win32 File Version resource will be populated by the Win32 Assembly Version resource.

如果指定 /win32res,则 /fileversion 不会影响 Win32 资源。If /win32res is specified, /fileversion does not affect the Win32 resource.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyFileVersionAttribute)。You can also specify this option as a custom attribute (AssemblyFileVersionAttribute) in the source code for any MSIL module.
/flags: flags/flags: flags 为程序集中的 Flags 字段指定一个值。Specifies a value for the Flags field in the assembly. flags 的可能的值有:Possible values for flags:

0x00000x0000
程序集是相邻兼容的。The assembly is side-by-side compatible.

0x00100x0010
程序集无法与其他版本在同一应用程序域中一起执行。The assembly cannot execute with other versions if they are executing in the same application domain.

0x00200x0020
程序集无法与其他版本在同一进程中一起执行。The assembly cannot execute with other versions if they are executing in the same process.

0x00300x0030
程序集无法与其他版本在同一计算机上一起执行。The assembly cannot execute with other versions if they are executing on the same computer.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyFlagsAttribute)。You can also specify this option as a custom attribute (AssemblyFlagsAttribute) in the source code for any MSIL module.
/fullpaths/fullpaths 使 Al.exe 对错误消息中报告的任何文件使用绝对路径。Causes Al.exe to use the absolute path for any files that are reported in an error message.
/help/help 显示该工具的命令语法和选项。Displays command syntax and options for the tool.
/keyf[ile]: filename/keyf[ile]: filename 指定一个文件 (filename),该文件包含密钥对或只包含用于对程序集进行签名的公钥。Specifies a file (filename) that contains a key pair or just a public key to sign an assembly. 编译器在程序集清单中插入公钥,然后使用私钥对最终的程序集进行签名。The compiler inserts the public key in the assembly manifest and then signs the final assembly with the private key. 有关生成密钥文件并将密钥对安装到密钥容器中的信息,请参见强名称工具 (Sn.exe)See the Strong Name Tool (Sn.exe) for information about generating key files and installing key pairs into key containers.

如果使用延迟签名,此文件通常会具有公钥而不是私钥。If you are using delayed signing, this file will usually have the public key but not the private key.

(密钥对的)公钥信息显示在程序集的 .publickey 字段中。The public key (of the key pair) information appears in the .publickey field of the assembly.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyKeyFileAttribute)。You can also specify this option as a custom attribute (AssemblyKeyFileAttribute) in the source code for any MSIL module.

如果在同一编译中同时指定 /keyfile 和 /keyname(通过命令行选项或通过自定义属性),则 Al.exe 将首先尝试用 /keyname 指定的容器 。If both /keyfile and /keyname are specified (either by command-line option or by custom attribute) in the same compilation, Al.exe will first try the container specified with /keyname. 如果成功,则使用密钥容器中的信息对程序集签名。If that succeeds, the assembly is signed with the information in the key container. 如果 Al.exe 没有找到密钥容器,它将尝试用 /keyfile 指定的文件。If Al.exe does not find the key container, it will try the file specified with /keyfile. 如果成功,则使用密钥文件中的信息对程序集签名,并且将密钥信息安装到密钥容器中(类似于 Sn.exe 中的 -i 选项),以便在下一次编译中,/keyname 选项将生效。If that succeeds, the assembly is signed with the information in the key file and the key information will be installed in the key container (similar to the -i option in Sn.exe) so that on the next compilation, the /keyname option will be valid.
/keyn[ame]: text/keyn[ame]: text 指定保存密钥对的容器。Specifies a container that holds a key pair. 这样将会通过将公钥插入程序集清单来对程序集签名(为它指定一个强名称)。This will sign the assembly (give it a strong name) by inserting a public key into the assembly manifest. 然后,Al.exe 使用私钥对最终程序集进行签名。Al.exe will then sign the final assembly with the private key.

使用 Sn.exe 生成密钥对。Use Sn.exe to generate a key pair.

密钥信息显示在程序集的 .publickey 字段中。The key information appears in the .publickey field of the assembly.

如果有嵌入的空格,请用双引号 (" ") 将 text 引起来。Place text in double quotation marks (" ") if there is an embedded space.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyKeyNameAttribute)。You can also specify this option as a custom attribute (AssemblyKeyNameAttribute) in the source code for any MSIL module.
/main: method/main: method 指定方法的完全限定名称 (class.method),以用作将模块转换为可执行文件时的入口点。Specifies the fully qualified name (class.method) of the method to use as an entry point when converting a module to an executable file.
/nologo/nologo 调用 Al.exe 时,在命令行取消显示横幅或徽标。Suppresses the banner, or logo, displayed at the command line when you invoke Al.exe.
/out: filename/out: filename 指定 Al.exe 生成的文件的名称。Specifies the name of the file produced by Al.exe. 这是必需选项。This is a required option.
/platform: text/platform: text 限制可以运行该代码的平台;必须为 x86、Itanium、x64、anycpu(默认值)之一,或 anycpu32bitpreferred。Limits which platform this code can run on; must be one of x86, Itanium, x64, anycpu (the default), or anycpu32bitpreferred.
/prod[uct]: text/prod[uct]: text 为程序集中的“产品”字段指定字符串。Specifies a string for the Product field in the assembly. 如果 text 包含空格,则将字符串放置在双引号 (" ") 中。Place the string in double quotation marks (" ") if text contains a space. 此字符串是程序集上的自定义特性,可以使用反射进行查看。This string is a custom attribute on the assembly and is available for viewing with reflection.

如果不指定 /win32res,则 /product 在文件资源管理器中将显示为 Win32“产品名称”资源。If you do not specify /win32res, /product appears in File Explorer as the Win32 Product Name resource.

如果文本是空字符串,则 Win32“产品名称”资源将会显示为一个空格。If text is an empty string, the Win32 Product Name resource appears as a single space.

如果指定 /win32res,则 /product 将不会影响 Win32 资源信息。If you specify /win32res, /product will not affect the Win32 resource information.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyProductAttribute)。You can also specify this option as a custom attribute (AssemblyProductAttribute) in the source code for any MSIL module.
/productv[ersion]: text/productv[ersion]: text 为程序集中的“产品版本”字段指定字符串。Specifies a string for the Product Version field in the assembly. 如果 text 包含空格,则将字符串放置在双引号 (" ") 中。Place the string in double quotation marks (" ") if text contains a space. 此字符串是程序集上的自定义特性,可以使用反射进行查看。This string is a custom attribute on the assembly and is available for viewing with reflection.

如果不指定 /win32res,则 /productversion 将用作 Win32“产品版本”资源。If you do not specify /win32res, /productversion will be used as the Win32 Product Version resource. 如果不指定 /productversion,则 Win32“产品版本”资源将由 Win32“文件版本”资源填充。If you do not specify /productversion, the Win32 Product Version resource will be populated by the Win32 File Version resource.

如果指定 /win32res,则 /productversion 将不会影响 Win32 资源信息。If you specify /win32res, /productversion will not affect the Win32 resource information.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyInformationalVersionAttribute)。You can also specify this option as a custom attribute (AssemblyInformationalVersionAttribute) in the source code for any MSIL module.
/t[arget]: lib[rary] | exe | win[exe]/t[arget]: lib[rary] | exe | win[exe] 指定输出文件的文件格式:lib[rary](代码库)、exe(控制台应用程序)或 win[exe](基于 Windows 的应用程序)。Specifies the file format of the output file: lib[rary] (code library), exe (console application), or win[exe] (Windows-based application). 默认值为 lib[rary]The default is lib[rary].
/template: filename/template: filename 指定程序集 filename,除区域性字段之外的所有程序集元数据都从该程序集继承。Specifies the assembly, filename, from which to inherit all assembly metadata, except the culture field.

使用 /template 创建的程序集将成为附属程序集。An assembly that you create with /template will be a satellite assembly.
/title: text/title: text 为程序集中的“标题”字段指定字符串。Specifies a string for the Title field in the assembly. 如果 text 包含空格,则将字符串放置在双引号 (" ") 中。Place the string in double quotation marks (" ") if text contains a space. 此字符串是程序集上的自定义特性,可以使用反射进行查看。This string is a custom attribute on the assembly and is available for viewing with reflection.

如果不指定 /win32res,则 /title 在文件资源管理器中将显示为 Win32“说明”资源,shell 将其用作应用程序的友好名称。If you do not specify /win32res, /title appears in File Explorer as the Win32 Description resource, which is used by the shell as the friendly name of an application. 如果某个文件类型有多个支持应用程序,则该字符串也会出现在此文件类型的快捷菜单的“打开方式”子菜单中。It is also displayed on the Open With submenu of the shortcut menu for a file type for which there are multiple supporting applications.

如果文本是空字符串,则 Win32“说明”资源将显示为一个空格。If text is an empty string, the Win32 Description resource appears as a single space.

如果指定 /win32res,则 /title 将不会影响 Win32 资源信息。If you specify /win32res, /title will not affect the Win32 resource information.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyTitleAttribute)。You can also specify this option as a custom attribute (AssemblyTitleAttribute) in the source code for any MSIL module.
/trade[mark]: text/trade[mark]: text 为程序集中的“商标”字段指定字符串。Specifies a string for the Trademark field in the assembly. 如果 text 包含空格,则将字符串放置在双引号 (" ") 中。Place the string in double quotation marks (" ") if text contains a space. 此字符串是程序集上的自定义特性,可以使用反射进行查看。This string is a custom attribute on the assembly and is available for viewing with reflection.

如果不指定 /win32res,则 /trademark 在文件资源管理器中将显示为 Win32“商标”资源。If you do not specify /win32res, /trademark appears in File Explorer as the Win32 Trademark resource.

如果文本是空字符串,则 Win32“商标”资源将显示为一个空格。If text is an empty string, the Win32 Trademark resource appears as a single space.

如果指定 /win32res,则 /trademark 将不会影响 Win32 资源信息。If you specify /win32res, /trademark will not affect the Win32 resource information.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyTrademarkAttribute)。You can also specify this option as a custom attribute (AssemblyTrademarkAttribute) in the source code for any MSIL module.
/v[ersion]: version/v[ersion]: version 指定此程序集的版本信息。Specifies version information for this assembly. 版本字符串的格式为 major.minor.build.revision。默认值为 0。The format of the version string is major.minor.build.revision. The default value is 0.

如果指定 /version,则必须指定 majorIf you do specify /version, you must specify major. 如果指定 majorminor,则可以为 build 指定星号 (*)。If you specify major and minor, you can specify an asterisk (*)for build. 这会使 build 等于从当地时间 2000 年 1 月 1 日算起的天数,使 revision 等于从当地时间当日午夜算起的秒数的一半。This causes build to be equal to the number of days since January 1, 2000, local time, and revision to be equal to the number of seconds since midnight of the current day, local time, divided by 2.

如果指定 majorminorbuild,则可以指定一个星号作为 revisionIf you specify major, minor, and build, you can specify an asterisk for revision. 这会使 revision 等于从当地时间当地午夜算起的秒数的一半。This causes revision to be equal to the number of seconds since midnight of the current day, local time, divided by 2.

概括而言,有效的版本字符串如下:To summarize, the valid version strings are as follows:

XX

X.XX.X

X.X.*X.X.*

X.X.XX.X.X

X.X.X.*X.X.X.*

X.X.X.XX.X.X.X

其中,X 是 0 至 65534 之间(不含 65535)的任何一个无符号短常数。where X is any unsigned short constant except 65535 (0-65534).

如果不指定 /win32res,则 /version 将用作 Win32“程序集版本”资源。If you do not specify /win32res, /version will be used as the Win32 Assembly Version resource.

如果不指定 /win32res/productversion/fileversion,则 /version 将用于“程序集版本”、文件版本和“产品版本”Win32 资源。If you do not specify /win32res, /productversion, and /fileversion, /version will be used for the Assembly Version, File Version, and Product Version Win32 resources.

如果指定 /win32res,则 /version 将不会影响 Win32 资源信息。If you specify /win32res, /version will not affect the Win32 resource information.

还可以将此选项指定为任何 MSIL 模块的源代码中的自定义特性 (AssemblyVersionAttribute)。You can also specify this option as a custom attribute (AssemblyVersionAttribute) in the source code for any MSIL module.
/win32icon: filename/win32icon: filename 在程序集中插入 .ico 文件。Inserts an .ico file in the assembly. .ico 文件在文件资源管理器中赋予输出文件所需的外观。The .ico file gives the output file the desired appearance in File Explorer.
/win32res: filename/win32res: filename 在输出文件中插入 Win32 资源(.res 文件)。Inserts a Win32 resource (.res file) in the output file. 可使用资源编译器创建 Win32 资源文件。A Win32 resource file can be created by using the Resource Compiler. 在编译 Visual C++ 程序时会调用资源编译器;.res 文件是从 .rc 文件创建的。The Resource Compiler is invoked when you compile a Visual C++ program; a .res file is created from the .rc file.
@filename 指定包含 Al.exe 命令的响应文件。Specifies a response file that contains Al.exe commands.

响应文件中的命令既可以每行显示一个,也可以显示在同一行中,用一个或多个空格分隔。Commands in the response file can appear one per line or on the same line, separated by one or more spaces.
/?/? 显示该工具的命令语法和选项。Displays command syntax and options for the tool.

备注Remarks

所有 Visual Studio 编译器都产生程序集。All Visual Studio compilers produce assemblies. 但是,如果有一个或多个模块(没有清单的元数据),则可使用 Al.exe 在单独的文件中创建带清单的程序集。However, if you have one or more modules (metadata without a manifest), you can use Al.exe to create an assembly with the manifest in a separate file.

若要在缓存中安装程序集,从缓存中删除程序集或列出缓存内容,请使用全局程序集缓存工具 (Gacutil.exe)To install assemblies in the cache, remove assemblies from the cache, or list the contents of the cache, use the Global Assembly Cache Tool (Gacutil.exe).

错误和警告Errors and Warnings

下表列出了 Al.exe 生成的错误。The following table lists the errors generated by Al.exe.

错误Error 描述Description
al1001al1001 内部编译器错误Internal compiler error

尝试确定 Al.exe 是否因为无法分析意外语法而失败。Try to determine whether Al.exe is failing because of its inability to parse unexpected syntax. 然后,请与 Microsoft 产品支持服务联系。Then, contact Microsoft Product Support Services.
al1002al1002 内存不足Out of memory

Al.exe 内存不足,已停止。Al.exe ran out of memory and stopped. 增加可用内存量。Increase the amount of available memory.
al1003al1003 编译器选项“option”后面必须有参数Compiler option 'option' must be followed by an argument

Al.exe 预期一个自变量被传递到命令行选项。Al.exe expected an argument to be passed to a command-line option. 例如,如果指定 /algid: ,则必须传递算法标识符。For example, if you specify /algid:, you must pass an algorithm identifier.
al1004al1004 意外的公共语言运行时初始化错误 --“reason”Unexpected common language runtime initialization error — 'reason'

Al.exe 报告了 Visual Studio 的安装错误,或者特定原因导致的公共语言运行时错误。Al.exe reported an error with the installation of Visual Studio or the common language runtime for the specified reason.
al1005al1005 文件“file”太大,无法打开File 'file' too big to open

Al.exe 打开的所有文件都必须小于 4 GB。All files opened by Al.exe must be smaller than 4 gigabytes (GB).
al1006al1006 已包含响应文件“file”Response file 'file' was already included

在命令行上多次指定了同一个响应文件 (@file)。The same response file was specified (@file) more than once on the command line. 响应文件只能包含一次。The response file can only be included once.
al1007al1007 打开响应文件“file”时出错 —“reason”Error opening response file 'file' — 'reason'

Al.exe 因特定原因无法打开指定的响应文件。Al.exe cannot open the specified response file for the specified reason.
al1008al1008 缺少“option”命令行选项的文件规范Missing file specification for 'option' command-line option

Al.exe 预期一个文件被传递到命令行选项。Al.exe expected a file to be passed to a command-line option. 例如,如果指定 /out 选项,则必须指定文件。For example, if you specify the /out option, you must specify a file.
al1009al1009 无法打开“file”以进行写入Can't open 'file' for writing

Al.exe 无法写入文件,例如输出程序集文件。Al.exe was unable to write to a file, such as the output assembly file. 磁盘可能已满,该文件可能是只读的,或者你可能不具有对该文件的权限。The disk might be full, the file might be read-only, or you might not have permissions to the file.
al1010al1010 命令行语法错误:“选项”选项缺少“:text”Command-line syntax error: Missing ':text' for 'option' option

Al.exe 预期一个自变量被传递到命令行选项。Al.exe expected an argument to be passed to a command-line option. 例如,如果指定 /title 选项,则必须传递字符串。For example, if you specify the /title option, you must pass a string.
al1011al1011 文件“file”是可执行文件,无法作为文本文件打开File 'file' is an executable file and cannot be opened as a text file

在预期为文本文件之处指定了二进制文件。A binary file was specified where a text file was expected. 例如,如果将二进制文件作为响应文件传递到命令行上,将发生此错误。For example, this error occurs if a binary file is passed on the command line as a response file.
al1012al1012 “value”不是选项“option”的有效设置'value' is not a valid setting for option 'option'

意外值被传递到命令行选项。An unexpected value was passed to a command-line option. 例如,如果将无效值指定到 /target 选项,则将发生此错误。For example, this error occurs if you specify an invalid value to the /target option.
al1013al1013 无法识别的命令行选项:“option”Unrecognized command-line option: 'option'

已指定无效的命令行选项。An invalid command-line option was specified.
al1014al1014 意外的初始化错误 —“reason”Unexpected initialization error — 'reason'

Al.exe 检测到 COM 初始化失败。Al.exe detected a COM initialization failure. 这可能是由于缺少内存所致,但更可能是因系统 DLL 文件所致。This might be caused by a lack of memory, but a more likely cause is the system DLL files. 如果运行任何自动化感知或 COM 感知的程序(如 Microsoft Visual Studio),应会发生类似的错误。You should see a similar error if you run any Automation-aware or COM-aware program, such as Microsoft Visual Studio.

重新安装操作系统。Reinstall the operating system.
al1015al1015 无法找到消息文件“alinkui.dll”Unable to find messages file 'alinkui.dll'

Al.exe 需要 Alinkui.dll 。Al.exe requires Alinkui.dll. 确保此文件位于你的路径。Make sure that this file is on your path. 如有必要,请从产品 CD 将其复制。If necessary, copy it from the product CD.
al1016al1016 未指定有效输入文件No valid input files were specified

Al.exe 要求不具有程序集信息的一个或多个输入文件。Al.exe requires one or more input files that do not have assembly information.
al1017al1017 未指定目标文件名No target file name was specified

缺少指定目标文件名必需的 /out 选项。The required /out option specifying the target file name was missing.
al1018al1018 无法加载所需的文件“file”Required file 'file' could not be loaded

无法加载某些 DLL 文件。Certain DLL files cannot be loaded. 重新安装 Visual Studio 或 Windows SDK。Reinstall Visual Studio or the Windows SDK.
al1019al1019 创建程序集时元数据失败 — 原因Metadata failure while creating assembly—reason

由于特定原因,程序集生成中断。Generation of the assembly was interrupted for the specified reason. 例如,如果未找到用 /win32res 选项指定的文件,将发生此错误。For example, this error occurs if a file that you specify with the /win32res option is not found.
al1020al1020 忽略包含的程序集“file”Ignoring included assembly 'file'

指定了包含程序集的输入文件。An input file that contained an assembly was specified. Al.exe 输入文件无法包含程序集。Al.exe input files cannot contain assemblies.
al1021al1021 “setting”: 重写以前的设置'setting' : overriding previous setting

模块具有特定设置的值,该值可能是通过自定义属性分配,并通过使用 Al.exe 命令行选项传递的值进行重写。A module had a value for a particular setting, possibly assigned through custom attributes, which was overridden with a value passed using an Al.exe command-line option.
al1022al1022 读取嵌入资源“file”时出错 — 原因Error reading embedded resource 'file'—reason

由于特定原因,Al.exe 无法读取传递到 /embedresource 选项的文件。Al.exe cannot read the file passed to the /embedresource option for the specified reason.
al1023al1023 嵌入资源“file”时出错 — 原因Error embedding resource 'file'—reason

由于特定原因,操作系统无法在程序集中嵌入资源文件。The operating system cannot embed the resource file in the assembly for the specified reason.
al1025al1025 ComType 记录“record”指向无效的文件记录“record”ComType record 'record' points to an invalid file record 'record'

输入模块中的元数据无效。Metadata in the input module is invalid. 必须修复生成该模块的工具。The tool that produced the module must be fixed.
al1026al1026 指定的版本“version”无效The version specified 'version' is invalid

查看有关有效格式的 /version 选项的信息。See information about the /version option for valid formats.
al1028al1028 密钥文件“file”缺少签名所需的私钥Key file 'file' is missing the private key needed for signing

已将仅包含公钥的密钥文件传递到 /keyfile 选项。A key file that contains only the public key was passed to the /keyfile option. 如以下命令所示,使用强名称工具 (Sn.exe) 以生成同时具有公钥和私钥的文件。Use the Strong Name Tool (Sn.exe) to generate a file that has both a public and private key, as shown in the following command.

sn -k keypair.snk.
al1029al1029 密钥容器名称“container”不存在The key container name 'container' does not exist

传递到 /keyname 选项的值不是有效的容器。The value passed to the /keyname option is not a valid container. 使用强名称工具 (Sn.exe) 创建容器。Use the Strong Name Tool (Sn.exe) to create a container.
al1030al1030 未正确安装加密服务或其不具有合适的密钥提供程序The cryptographic service is not installed properly or does not have a suitable key provider

可能需要重新安装操作系统,或者安装一些用于创建该密钥的加密实用工具。You might have to reinstall the operating system or install some cryptographic utility that was used to create the key.
al1031al1031 读取图标“file”时出错 — 原因Error reading icon 'file'—reason

由于特定原因,Al.exe 无法读取传递到 /win32icon 选项的文件Al.exe cannot read the file that was passed to the /win32icon option for the specified reason
al1032al1032 为“file”生成资源时出错 — 原因Error generating resources for 'file'—reason

由于没有足够的磁盘空间或某些其他错误,Al.exe 无法创建文件。Al.exe cannot create a file because of insufficient disk space or some other error. 当指定 /win32icon 选项(生成 .ico 文件)或不指定 /win32res 选项(生成具有资源信息的文件)时,将发生此错误。This error occurs when you specify the /win32icon option (which generates an .ico file) or do not specify the /win32res option (which generates a file that has resource information).

如果无法解决文件生成问题,则使用 /win32res,可指定可以包含版本或位图(图标)信息的文件。If you cannot resolve the file generation problem, use /win32res, which specifies a file that can contain version or bitmap (icon) information.
al1033al1033 多次使用不同值指定了程序集自定义特性“attribute”Assembly custom attribute 'attribute' was specified multiple times with different values

已将不同的值传递给源模型中同一自定义属性的两个匹配项,此源模型指定为 Al.exe 的输入。Different values were passed to two occurrences of the same custom attribute in source modules that are specified as input to Al.exe.
al1034al1034 无法复制或重命名程序集“file”Assembly 'file' cannot be copied or renamed

使用既可使用户指定输入文件,又可复制输入文件的 Al.exe 语法时,会产生名称冲突,导致编译器停止。While using the Al.exe syntax that enables you to both specify an input file and copy it, a name conflict arose that stopped the compiler. 例如,如果指定 input.dll,somename.dll /out:somename.dll,将产生此错误。For example, this error occurs if you specify input.dll,somename.dll /out:somename.dll.
al1035al1035 库不能有一个入口点Libraries cannot have an entry point

不能同时指定 /target:lib 选项(默认)和 /main 选项。You cannot specify both the /target:lib option (the default) and the /main option.
al1036al1036 可执行应用程序所需的入口点Entry point required for executable applications

当使用 /target:exe/target:win 选项时,还必须指定 /main 选项。When using the /target:exe or /target:win option, you must also specify the /main option.
al1037al1037 无法找到入口点方法“main”Unable to find the entry point method 'main'

Al.exe 在 /main 选项指定的位置找不到 Main 方法。Al.exe cannot find a Main method at the location specified by the /main option.
al1039al1039 全局程序集缓存管理器的初始化失败 — 原因Initialization of global assembly cache manager failed—reason

重新安装 Visual Studio 或 Windows SDK。Reinstall Visual Studio or the Windows SDK.
al1040al1040 未能将程序集安装到缓存 — 原因Failed to install assembly into cache—reason

仅签名的程序集可安装到缓存中。Only signed assemblies can be installed into the cache. 有关详细信息,请参阅全局程序集缓存For more information, see Global Assembly Cache.
al1041al1041 “method”: 不能为入口点,因为签名或可见性不正确,或者它是泛型'method': cannot be the entry point because the signature or visibility is incorrect, or it is generic

使用 /main 选项指定了一种方法,但该方法不是静态的,不会返回 intvoid,该方法是泛型类型,或者具有无效自变量。A method was specified with the /main option, but that method is not static, does not return int or void, was generic, or has invalid arguments.
al1042al1042 “exe”:不能向 EXE 添加模块'exe': EXEs cannot be added modules

已将不具有程序集的 .exe 文件指定为 Al.exe 的输入文件 。An .exe file that does not have an assembly was specified as an input file to Al.exe. Al.exe 只能接受不具有程序集的 .dll 文件作为输入文件 。Al.exe can only take dll files without assemblies as input files.
al1043al1043 清单文件名“name”不能和任何模块相同Manifest file name 'name' cannot be the same as any modules

使用 /out 选项指定的名称不能与任何一个指定为 Al.exe 的输入文件的名称相同。The name specified with the /out option cannot be the same as any one of the file names that are specified as input to Al.exe.
al1044al1044 读取密钥文件“file”时出错 — 原因Error reading key file 'file'—reason

从使用 /keyfile 或 AssemblyKeyFileAttribute 指定的文件打开或读取时出错。An error occurred while opening or reading from a file specified with /keyfile or the AssemblyKeyFileAttribute.
al1045al1045 文件名“file”太长或无效Filename 'file' is too long or invalid

将长于 260 个字符的文件名传递给 Al.exe。A file name longer than 260 characters was passed to Al.exe. 选择字符较少或路径较短的文件名或重命名该文件。Choose a file name with fewer characters or a shorter path, or rename the file.
al1046al1046 此程序集中已使用了资源标识符“ID”Resource identifier 'ID' has already been used in this assembly

内嵌或链接的两个资源具有相同的标识符或名称(第二个参数)。Two resources, embedded or linked, have the same identifier or name (the second argument). 删除或重命名其中一个冲突资源。Remove or rename one of the conflicting resources.
al1047al1047 导入文件“file”时出错 — 原因Error importing file 'file'—reason

由于特定原因,无法打开模块文件。A module file cannot be opened for the specified reason.
al1048al1048 导入程序集“assembly”的模块“module”时出错 — 原因Error importing module 'module' of assembly 'assembly'—reason

打开多文件程序集的非清单文件时出错。An error occurred when opening a nonmanifest file of a multifile assembly. 此错误不直接由 Al.exe 发出,但可将它以编程的方式传递给使用 Al.exe 的进程 。This error is not emitted directly by Al.exe, but can be passed programmatically to a process that uses Al.exe.
al1049al1049 不能自动生成日期在 2000 年 1 月 1 日之前的生成版本号和修订版本号Cannot auto-generate build and revision version numbers for dates before January 1, 2000

你计算机上的系统时钟设置为早于 2000 年 1 月 1 日的日期。The system clock on your computer is set to a date earlier than January 1, 2000.
al1050al1050 不再支持使用“旧功能”;请改为使用“新功能”The feature you are using 'old feature' is no longer supported; please use 'new feature' instead

以前由 Al.exe 支持的一项功能现已过时。A feature previously supported by Al.exe is now obsolete. 请改用推荐的功能。Use the recommended feature instead.
al1051al1051 发出“attribute”特性时出错 — 原因Error emitting 'attribute' attribute—reason

由于特定原因,Al.exe 未处理一项程序集自定义属性。An assembly custom attribute was not processed by Al.exe for the specified reason.
al1052al1052 文件“filename”不是程序集File 'filename' is not an assembly

使用 /template 指定的文件必须包含程序集元数据。The file specified with /template must contain assembly metadata. 此错误指示 /template 指定的文件未包含程序集。This error indicates that the file specified by /template did not contain an assembly.
al1053al1053 为“option”指定的版本“version”不是常规的“major.minor.build.revision”格式The version 'version' specified for the 'option' is not in the normal 'major.minor.build.revision' format

Al.exe 检测到使用 /fileversion 或 /productversion 选项指定的格式不正确的版本信息 。Al.exe detected ill-formed version information specified with the /fileversion or /productversion options.
al1054al1054 为“option”指定的版本“version”不是常规的“major.minor.build.revision”格式The version 'version' specified for the 'option' is not in the normal 'major.minor.build.revision' format

Al.exe 检测到使用 SatelliteContractVersionAttribute 指定的格式不正确的版本信息。Al.exe detected ill-formed version information specified with the SatelliteContractVersionAttribute.
al1055al1055 引用的程序集“filename”没有强名称Referenced assembly 'filename' does not have a strong name

当构建具有强名称的程序集,并且引用不具有强名称的程序集时,会发出此错误。This error is issued when you are building an assembly with a strong name and reference an assembly that does not have a strong name. 若要解决此问题,必须再生成具有强名称的程序集,或通过使用 sn.exe 将强名称附加到程序集(请参阅 sn.exe 的文档) 。To fix this, you must either regenerate your assembly with a strong name, or attach a strong name to the assembly by using Sn.exe (see the documentation for Sn.exe).

此错误通常发生在通过包装程序集使用 COM 对象时,如通过 Visual Studio IDE 将对 COM 模块的引用添加到 C# 项目时。A common occurrence of this error is when you are using COM objects by way of wrapper assemblies, such as when you add a reference to a COM module to a C# project by way of the Visual Studio IDE. 若要避免此错误,可以在项目属性“包装程序集密钥文件/名称”中指定 COM 包装程序集的强名称密钥文件To avoid the error, you can specify the strong name key file for COM wrapper assemblies in the Project Property "Wrapper Assembly Key File/Name"

如果要通过 tlbimp 创建包装程序集,请参阅 tlbimp 文档了解有关如何向包装程序集分配强名称的信息。If you are creating the wrapper assembly through tlbimp, see the tlbimp documentation for information about how to assign a strong name to the wrapper assembly.

如果程序集具有强名称,则它可以安装在全局程序集缓存中。If an assembly has a strong name, it can be installed in the global assembly cache. 由此,引用的程序集也将进入全局程序集缓存。Consequently, referenced assemblies would also go into the global assembly cache. 只有具有强名称的程序集才可进入全局程序集缓存。Only assemblies with strong names can go into the global assembly cache.
al1056al1056 引用的程序集“filename”是已本地化的附属程序集Referenced assembly 'filename' is a localized satellite assembly

在创建当前程序集时引用了通过使用 AssemblyCultureAttribute 特性创建的程序集。An assembly created by using the AssemblyCultureAttribute attribute was referenced in creating the current assembly. AssemblyCultureAttribute 特性指示该文件是已本地化的附属程序集,并且不合适引用附属程序集。The AssemblyCultureAttribute attribute indicates the file is a localized satellite assembly and it is not appropriate to reference a satellite assembly. 改为引用主要父程序集。Reference the main parent assembly instead.
al1057al1057 可执行文件不能进行本地化;区域性应始终为空Executables cannot be localized, Culture should always be empty

正在使用 /target:exe 创建程序集,但指定了 /cultureAn assembly is being created by using /target:exe but /culture was specified. .exe 中的程序集不能具有区域性字段中的信息。Assemblies in the .exe cannot have information in the Culture field.
al1058al1058 “file”是一个程序集,不能作为模块添加'file' is an assembly and cannot be added as a module

在 C++ 编译中,向 /assemblymodule(链接器选项)传递了包含程序集的文件。In a C++ compilation, /assemblymodule (linker option) was passed a file that contained an assembly.
al1059al1059 未知错误(代码)Unknown error (code)

Al.exe 收到了未知错误代码 (code)。Al.exe received an unknown error code (code).

可能的解决方案包括以下措施:Possible solutions include the following:

重新安装 Visual Studio。Reinstall Visual Studio.

重新安装 Windows SDK。Reinstall the Windows SDK.

检查是否缺少文件。Check for missing files.

检查是否有足够的磁盘空间。Check for adequate disk space.

检查是否有足够的内存。Check for adequate memory.

停止可能正在访问这些文件的其他进程。Stop other processes that might be accessing the files.

重新启动计算机。Reboot your computer.
al1060al1060 创建哈希时加密失败 — 原因Cryptographic failure while creating hashes—reason

为多文件程序集创建文件哈希值时出错。An error occurred while creating the file hashes for a multifile assembly.
al1061al1061 由于“reason”,无法设置选项“option”Cannot set option 'option' because 'reason'

由于指定原因,为此选项指定的值无效。The value specified for this option is invalid for the specified reason.
al1062al1062 已多次指定了模块“module”;它将仅被包含一次Module 'module' was specified multiple times; it will only be included once

当在命令行上多次指定相同的源、输入或模块文件时,将生成此警告。This warning is generated when the same source, input, or module file is specified multiple times on the command line. 确保仅指定该文件名称一次。Make sure that you specify the file name only once.
al1063al1063 在此程序集的多个位置定义了公共类型“type”:“file1”和“file2”Public type 'type' is defined in multiple locations in this assembly: 'file1' and 'file2'

在程序集的不止一个模块中找到相同类型。The same type was found in more than one module in the assembly. 每种类型在一个程序集中只能有一个版本。Only one version of each type may be present in an assembly.
al1064al1064 无法指定多个 /bugreport 选项。Cannot specify multiple /bugreport options.

仅允许一个 /bugreport 选项。Only one /bugreport option is allowed.
al1065al1065 文件名“File Name”太长或无效File name 'File Name' is too long or invalid

指定的文件名长于允许的最大长度。The specified file name is longer than the maximum allowed.
al1066al1066 在命令行上或响应文件中不允许有字符“character”Character 'character' is not allowed on the command line or in response files

在命令行上或在文件中找到了无效的字符。An invalid character was found, either on the command line or in a file.
al1067al1067 “filename”是二进制文件而非文本文件'filename' is a binary file instead of a text file

该文件是二进制格式,而不是文本格式。The file is in binary format instead of text.
al1068al1068 已在此程序集中定义了模块“ModuleName”。Module 'ModuleName' is already defined in this assembly. 每个链接的资源和模块必须具有唯一的文件名。Each linked resource and module must have a unique file name.

该模块在此程序集中不止出现一次。The module occurs more than once in this assembly.
al1069al1069 当已存在具有相同短文件名的长文件名时,无法创建短文件名“filename”Cannot create short file name 'filename' when a long file name with the same short file name already exists

当前文件的名称为已存在的文件的名称的较短形式。The current file has a name that is the short version of a file name that already exists. 例如,编译 LongFileName.cs,然后使用名称 LongFi~1.cs 重新编译将导致类似于此的编译器错误。For example, compiling LongFileName.cs and then recompiling with the name LongFi~1.cs will cause a compiler error similar to this. 如果已删除了具有长名称的编译器输出文件,但依然存在类似的链接器文件,则可能会出现此错误。If the compiler output files that have long names were deleted, but the analogous linker files remained, this error might occur.
al1070al1070 不可知的程序集不能具有特定于处理器的模块“Module Name”Agnostic assembly cannot have a processor-specific module 'Module Name'

如果正在使用 /platform:agnostic(或没有指定 /platform)进行构建,此时若尝试添加一个并非是不可知的模块(使用 /addmodule),将生成错误。If you are building using /platform:agnostic (or you don't specify /platform), an error will be generated if you try to add a module (using /addmodule) that is not agnostic. 这就像尝试将 i386 obj 文件链接到 ia64 obj。This is like trying to link an i386 obj file to an ia64 obj.

非不可知模块的主要来源是 C++。The main source of non-agnostic modules is C++. 如果正在使用 /addmodule 与 C++ 模块,可能需要修改生成脚本以指定合适的 /platform 设置。If you are using /addmodule with a C++ module, you may have to modify your build scripts to specify the appropriate /platform setting.
al1072al1072 程序集和模块“Module Name”不能以不同处理器为目标Assembly and module 'Module Name' cannot target different processors

不能链接针对不同处理器的程序集和模块,因为必须在单个处理器上运行结果。You cannot link an assembly and a module that are targeted for different processors, because the result has to run on a single processor.
al1073al1073 引用的程序集“assembly”面向的是另一个处理器Referenced assembly 'assembly' targets a different processor

不能链接针对不同处理器的程序集,因为必须在单个处理器上运行结果。You cannot link assemblies that are targeted for different processors, because the result has to run on a single processor.
al1074al1074 存储在“File Name”中的模块名称“Module Name”必须与其文件名匹配Module name 'Module Name' stored in 'File Name' must match its file name

这是链接器所必需的。This is required of the linker. 若要解决此问题,请使两个名称匹配。To resolve this problem, make the two names match.
al1075al1075 已请求延迟签名,但未提供密钥Delay signing was requested, but no key was given

在对程序集延迟签名时,编译器不会计算和存储签名,而只是在文件中保留空间以便稍后可添加签名。When an assembly is delay signed, the compiler does not compute and store the signature, but reserves space in the file so the signature can be added later.

例如,使用 /delaysign+ 可允许测试人员将程序集放入全局缓存中。For example, using /delaysign+ enables a tester to put the assembly in the global cache. 测试完成后,可使用“程序集链接器”实用工具将私钥添加到程序集,从而对程序集进行完整的签名。After testing, you can fully sign the assembly by adding the private key to the assembly by using the Assembly Linker utility.
al1076al1076 将类型“type”转发到多个程序集:“assembly”和“assembly”。Type 'type' is forwarded to multiple assemblies: 'assembly' and 'assembly'.

一种类型只能转发到一个程序集。A type can only be forwarded to one assembly.
al1077al1077 在“assembly”中定义公共类型“type”,并将其转发到“assembly”。Public type 'type' is defined in 'assembly' and forwarded to 'assembly'.

正在生成的程序集中具有重复的公共类型。There is a duplicate public type in the assembly being generated. 一个是有效的类型定义,另一个是类型转发器。One is a valid type definition and the other is a type forwarder.

示例Example

以下命令使用 t2.netmodule 模块中的程序集创建可执行文件 t2a.exe。The following command creates an executable file t2a.exe with an assembly from the t2.netmodule module. 入口点是 Main 中的 MyClass 方法。The entry point is the Main method in MyClass.

al t2.netmodule /target:exe /out:t2a.exe /main:MyClass.Main

请参阅See also