Al.exe (組件連結器)Al.exe (Assembly Linker)

組件連結器 (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. 如需詳細資訊,請參閱-C# Win32manifest (編譯器選項)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. 至於其他所有資源,請使用 GetManifestResource 中的 Assembly* 方法在執行階段存取資源。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 部分,以便安裝到全域組件快取中,並從組件的 Managed 程式碼存取。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. 如需詳細資訊,請參閱-C# Linkresource (編譯器選項)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. 至於其他所有資源,請使用 GetManifestResource 類別中的 Assembly* 方法在執行階段存取資源。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. 如需其他演算法,請參閱 Platform 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 Configuration 資源會顯示為單一空格。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 Copyright 資源。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-.

/delaysign 選項必須搭配 /keyfile/keyname 才有作用。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 Comments 資源。If you do not specify /win32res, /description appears in File Explorer as the Win32 Comments resource.

如果文字為空字串,Win32 Comments 資源會顯示為單一空格。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 File Version 資源。If you do not specify /win32res, /fileversion will be used as the Win32 File Version resource. 如不指定 /fileversion,系統會在 Win32 File Version 資源中填入 Win32 Assembly Version 資源。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 Product Name 資源。If you do not specify /win32res, /product appears in File Explorer as the Win32 Product Name resource.

如果文字為空字串,Win32 Product Name 資源會顯示為單一空格。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 Product Version 資源。If you do not specify /win32res, /productversion will be used as the Win32 Product Version resource. 如不指定 /productversion,系統會在 Win32 Product Version 資源中填入 Win32 File Version 資源。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 Description 資源,而殼層將使用此資源作為應用程式的易記名稱。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 Description 資源會顯示為單一空格。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 Trademark 資源。If you do not specify /win32res, /trademark appears in File Explorer as the Win32 Trademark resource.

如果文字為空字串,Win32 Trademark 資源會顯示為單一空格。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. 版本字串的格式為 majorminorbuildrevision。預設值為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,則可以指定星號 (*) 代表 buildIf you specify major and minor, you can specify an asterisk (*)for build. 這樣一來,build 就相當於自當地時間 2000 年 1 月 1 日起算的天數,而 revision 則等於自當地時間當天午夜起算的秒數除以 2。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 就等於自當地時間當天午夜起算的秒數除以 2。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 是指任何不帶正負號的簡短常數,但 65535 除外 (0-65534)。where X is any unsigned short constant except 65535 (0-65534).

如不指定 /win32res,系統會將 /version 作為 Win32 Assembly Version 資源。If you do not specify /win32res, /version will be used as the Win32 Assembly Version resource.

如不指定 /win32res/productversion/fileversion,系統會將 /version 作為 Win32 Assembly Version、File Version 和 Product Version 資源。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 未預期的 Common Language Runtime 初始化錯誤 — '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 開啟的所有檔案都必須小於 4GB。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 命令列語法錯誤: 遺漏 'option' 選項的 ':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.dllAl.exe requires Alinkui.dll. 請確定這個檔案在路徑中。Make sure that this file is on your path. 如有必要,請從產品光碟複製這個檔案。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 either reinstall the operating system or install some cryptographic utility that was that is 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. 如需詳細資訊,請參閱全域組件快取See Global Assembly Cache for more information.
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

從使用 /keyfileAssemblyKeyFileAttribute 指定的檔案中開啟或讀取時發生錯誤。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

傳遞至 Al.exe 的檔案名稱超過 260 個字元。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 匯入模組 'module' (屬於組件 'assembly') 時發生錯誤 — 原因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 不再支援您正使用的 'old feature' 功能; 請改用 'new feature'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 版本 'version' (指定給 'option') 不是使用一般的 '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 版本 'version' (指定給 'option') 不是使用一般的 '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 在 C# 專案的 COM 模組中加入參考時。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. 您可能應該改為參考主要父組件。You should probably 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 未知的錯誤 (code)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 無法設定選項 'option',因為 'reason'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++. 如果您搭配 C++ 模組使用 /addmodule,可能必須修改建置指令碼,以指定適當的 /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. 測試之後,您可以使用 Assembly Linker 公用程式將私密金鑰加入組件,以完整簽署組件。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 公用類型 'type' 定義於 'assembly' 中並轉送至 '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.exeThe 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