Assembly Linker (al.exe)

The Assembly Linker generates a file with an assembly manifest from one or more files that are either modules or resource files. A module is a common intermediate language (CIL) file that does not have an assembly manifest.

The application file for the Assembly Linker is named al.exe in Shared Source CLI (SSCLI) builds on Microsoft Windows®.

Note: The SSCLI implementation does not support Microsoft Win32® resources or cryptographic key containers.  The following options in the Microsoft .NET Framework implementation of the Assembly Linker are not supported by the SSCLI implementation of the Assembly Linker.

The following options are supported by the SSCLI implementation of the Assembly Linker.

Usage

al sources options

You can specify one or more of the following sources.

Source Description
file[,target] Copies the contents of file to the file name specified by target. After copying, al.exe compiles target into an assembly.
/embed[resource]:file[,name[, private]] 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.

The name parameter is an internal identifier for the resource. By default, resources are public in the assembly (visible to other assemblies). Specifying private makes the resource invisible to other assemblies.

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. For more information, see the System.Resources.ResourceManager class. For all other resources, use the GetManifestResource methods in the System.Reflection.Assembly class to access the resource at run time.

If only resource files are passed to al.exe, the output file is a satellite resource assembly.

/link[resource]:file[,name[,target[,private]]] Links a resource file to an assembly. The resource specified by file becomes part of the assembly; the file is not copied.

The name parameter is an internal identifier for the resource. The target parameter specifies a path and file name into which al.exe copies the file. After copying, al.exe compiles target into an assembly. By default, resources are public in the assembly (visible to other assemblies). Specifying private makes the resource invisible to other assemblies.

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. For more information, see System.Resources.ResourceManager. For all other resources, use the GetManifestResource methods in the System.Reflection.Assembly class to access the resource at run time.

If only resource files are passed to al.exe, the output file is a satellite resource assembly.

You can specify the following options; note that you must specify /out.

Options can be specified using either a dash (-) or a slash (/). 

Option Description
/algid:id Specifies an algorithm to hash all files in a multifile assembly except the file that contains the assembly manifest. The default algorithm is CALG_SHA1. For other algorithms, see ALG_ID in the Platform SDK documentation. 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.

You can also specify this option as a custom attribute (System.Reflection.AssemblyAlgorithmIdAttribute) in the source code for any module.

/base[address]:addr

Specifies the address at which the assembly is loaded on the user's computer at run time. Applications load faster if you specify the base address of the DLLs, rather than let the operating system relocate the DLLs in the process space.

Changes made to the assembly file as a result of this option are used only by the Windows file loader and have no effect when the file is loaded into the SSCLI using the clix loader.

/comp[any]:text Specifies a string for the Company field in the assembly. 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.

You can also specify this option as a custom attribute (System.Reflection.AssemblyCompanyAttribute) in the source code for any CIL module.

In the SSCLI implementation of the Assembly Linker, this information is written only to the assembly metadata.  No output is written to the Win32 resource data.

/config[uration]:text Specifies a string for the Configuration field in the assembly. 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.

You can also specify this option as a custom attribute (System.Reflection.AssemblyConfigurationAttribute) in the source code for any CIL module.

In the SSCLI implementation of the Assembly Linker, this information is written only to the assembly metadata.  No output is written to the Win32 resource data.

/copy[right]:text Specifies a string for the Copyright field in the assembly. 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.

You can also specify this option as a custom attribute (System.Reflection.AssemblyCopyrightAttribute) in the source code for any CIL module.

In the SSCLI implementation of the Assembly Linker, this information is written only to the assembly metadata.  No output is written to the Win32 resource data.

/c[ulture]:text Specifies the culture string to associate with the assembly. Valid values for cultures are those defined by the Internet Requests for Comments (RFC) document 1766 titled "Tags for the Identification of Languages."

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.

For information on valid text strings, see the CultureInfo class.

You can also specify this option as a custom attribute (System.Reflection.AssemblyCultureAttribute) in the source code for any CIL module.

/delay[sign][+|-] Specifies whether the assembly is fully or partially signed. Use /delaysign- if you want a fully signed assembly. Use /delaysign+ if you want only to place the public key in the assembly.

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. 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.

The default is /delaysign-.

The /delaysign option has no effect unless used with /keyfile or /keyname.

For example, using /delaysign+ allows a tester to put the assembly in the global cache. After testing, you can fully sign the assembly by placing the private key in the assembly.

You can also specify this option as a custom attribute (System.Reflection.AssemblyDelaySignAttribute) in the source code for any CIL module.

/descr[iption]:text Specifies a string for the Description field in the assembly. 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.

You can also specify this option as a custom attribute (System.Reflection.AssemblyDescriptionAttribute) in the source code for any CIL module.

In the SSCLI implementation of the Assembly Linker, this information is only written to the assembly metadata.  No output is written to the Win32 resource data.

/e[vidence]:file Embeds file in the assembly with the resource name of Security.Evidence.

You cannot use Security.Evidence for regular resources.

/flags:flags Specifies a value for the Flags field in the assembly. Possible values for flags are:
0x0000
The assembly is side-by-side compatible.
0x0010
The assembly cannot execute with other versions if the versions are executing in the same application domain.
0x0020
The assembly cannot execute with other versions if the versions are executing in the same process.
0x0030
The assembly cannot execute with other versions if the versions are executing on the same computer.

You can also specify this option as a custom attribute (System.Reflection.AssemblyFlagsAttribute) in the source code for any CIL module.

/fullpaths Causes al.exe to use the absolute path for any files that are reported in an error message.
/help Displays command syntax and options for the tool.
/keyf[ile]:filename Specifies a file (filename) that contains a key or key pair to sign an assembly. The compiler inserts the public key in the assembly manifest and then signs the final assembly with the private key. For information on generating key files and installing key pairs into key containers see the Strong Name Tool documentation.

If you are using delay-signing, this file has the public key but not the private key.

The key information appears in the .publickey field of the assembly.

You can also specify this option as a custom attribute (System.Reflection.AssemblyKeyFileAttribute) in the source code for any CIL module.

/main:method Specifies the fully qualified name of the method to use as an entry point when converting a module to an executable file.
/nologo Suppresses the banner, or logo, displayed at the command line when you invoke al.exe.
/out:filename Specifies the name of the file produced by al.exe. This is a required option.
/prod[uct]:text Specifies a string for the Product field in the assembly. 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.

You can also specify this option as a custom attribute (System.Reflection.AssemblyProductAttribute) in the source code for any CIL module.

/productv[ersion]:text Specifies a string for the Product Version field in the assembly. 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.

You can also specify this option as a custom attribute (System.Reflection.AssemblyInformationalVersionAttribute) in the source code for any CIL module.

In the SSCLI implementation of the Assembly Linker, this information is written only to the assembly metadata.  No output is written to the Win32 resource data.

/t[arget]:lib|exe|win Specifies the file format of the output file: lib (code library), exe (console application), or win (Windows-based application). The default is lib.
/template:filename Specifies the assembly, filename, from which to inherit all assembly metadata except the culture field. The specified filename must have a strong name.

An assembly that you create with /template is a satellite assembly.

/title:text Specifies a string for the Title field in the assembly. 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.

You can also specify this option as a custom attribute (System.Reflection.AssemblyTitleAttribute) in the source code for any CIL module.

/trade[mark]:text Specifies a string for the Trademark field in the assembly. 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.

You can also specify this option as a custom attribute (System.Reflection.AssemblyTrademarkAttribute) in the source code for any CIL module.

In the SSCLI implementation of the Assembly Linker, this information is written only to the assembly metadata.  No output is written to the Win32 resource data.

/v[ersion]:version Specifies version information for this assembly. The format of the version string is major.minor.build.revision. The default value is 0.

If you do specify /version, you must specify major. If you specify major and minor, you can specify an asterisk (*)for build. 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, January 1, 2000, local time, divided by 2.

If you specify major, minor, and build, you can specify an asterisk for revision. This causes revision to be equal to the number of seconds since midnight, January 1, 2000, local time, divided by 2.

To summarize, the valid version strings are:

X

X.X

X.X.*

X.X.X

X.X.X.*

X.X.X.X

where X is any unsigned short constant except 65535 (0-65534).

You can also specify this option as a custom attribute (System.Reflection.AssemblyVersionAttribute) in the source code for any CIL module.

In the SSCLI implementation of the Assembly Linker, this information is only written to the assembly metadata.  No output is written to the Win32 resource data.

@filename 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

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.

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).

Example

The following command creates an executable file t2a.exe with an assembly from the t2.dll module. The entry point is the Main method in MyClass.

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

al.exe Tool Errors and Warnings

The following table lists the errors generated by al.exe.

Error Description
al1001 Internal compiler error

al.exe might be failing because of an inability to parse unexpected syntax. 

al1002 Out of memory

al.exe ran out of memory and halted. Increase the amount of available memory.

al1003 Compiler option 'option' must be followed by an argument

al.exe expected an argument to be passed to a command-line option. For example, if you specify /algid:, you must pass an algorithm identifier.

al1004 Unexpected common language runtime initialization error - 'reason'

al.exe reported an error with the Visual Studio or common language runtime installation for the specified reason.

al1005 File 'file' too big to open

All files opened by al.exe must be smaller than 4 gigabytes (GB).

al1006 Response file 'file' was already included

The same response file was specified (@file) more than once on the command line. The response file can be included only once.

al1007 Error opening response file 'file' - 'reason'

al.exe cannot open the specified response file for the specified reason.

al1008 Missing file specification for 'option' command-line option

al.exe expected a file to be passed to a command-line option. For example, if you specify the /out option, you must specify a file.

al1009 Can't open 'file' for writing

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 access rights to the file.

al1010 Command-line syntax error: Missing ':text' for 'option' option

al.exe expected an argument to be passed to a command-line option. For example, if you specify the /title option, you must pass a string.

al1011 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.

al1012 'value' is not a valid setting for option 'option'

An unexpected value was passed to a command-line option. For example, this error occurs if you specify an invalid value to the /target option.

al1013 Unrecognized command-line option: 'option'

An invalid command-line option was specified.

al1014 Unexpected initialization error - 'reason'

al.exe detected an initialization failure. This might be caused by a lack of memory, but a more likely cause is a problem with your system files.

al1016 No valid input files were specified

al.exe requires one or more input files that do not have assembly information.

al1017 No target filename was specified

A command-line option was specified without a file parameter. For example, this error occurs if you specify /keyname:.

al1018 Required file 'file' could not be loaded

Certain executable files cannot be loaded.  Make sure the required file is available on your path.

al1019 Metadata failure while creating assembly - reason

Generation of the assembly was interrupted for the specified reason.

al1020 Ignoring included assembly 'file'

An input file that contained an assembly was specified. al.exe input files cannot contain assemblies.

al1021 'setting' : overriding previous setting

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.

al1022 Error reading embedded resource 'file' - reason

al.exe cannot read the file passed to the /embedresource option for the specified reason.

al1023 Error embedding resource 'file' - reason

The operating system cannot embed the resource file in the assembly for the specified reason.

al1025 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.

al1026 The version specified 'version' is invalid

See information on the /version option for valid formats.

al1028 Key file 'file' is missing the private key needed for signing

A key file that contains only the public key was passed to the /keyfile option. Use the Strong Name Tool (Sn.exe) to generate a file with both a public and private key, as shown in the following command.

sn -k keypair.snk.

al1029 The key container name 'container' does not exist

The value passed to the /keyname option is not a valid container. Use the Strong Name Tool (Sn.exe) to create a container.

al1030 The cryptographic service is not installed properly or does not have a suitable key provider

You might need to either reinstall your operating system or install some cryptographic utility that was used in the creation of the key.

al1031 Error reading icon 'file' - reason

al.exe cannot read the file that was passed to the /win32icon option for the specified reason.

al1032 Error generating resources for 'file' - reason

al.exe cannot create a file due to insufficient disk space or some other error.

al1033 Assembly custom attribute 'attribute' was specified multiple times with different values

Different values were passed to two occurrences of the same custom attribute in source modules that are specified as input to al.exe.

al1034 Assembly 'file' cannot be copied or renamed

While using the al.exe syntax that allows you to both specify an input file and copy it, a name conflict arose that stopped the compiler. For example, this error occurs if you specify input.dll,somename.dll /out:somename.dll.

al1035 Libraries cannot have an entry point

You cannot specify both the /target:lib option (the default) and the /main option.

al1036 Entry point required for executable applications

When using the /target:exe or /target:win option, you must also specify the /main option.

al1037 Unable to find the entry point method 'main'

al.exe cannot find a Main method at the location specified by the /main option.

al1039 Initialization of global assembly cache manager failed - reason

Reinstall or rebuild the SSCLI.

al1040 Failed to install assembly into cache - reason

Only signed assemblies can be installed into the cache.

al1041 'method': cannot be the entry point because the signature or visibility is incorrect

A method was specified with the /main option, but that method is not static, does not return int or void, or has invalid arguments.

al1042 'exe': EXEs cannot be added modules

An .exe file that does not have an assembly was specified as an input file to al.exe. al.exe can only take .dll files without assemblies as input files.

al1043 Manifest file name 'name' cannot be the same as any modules

The name specified with the /out option cannot be the same as any of the file names that are specified as input to al.exe.

al1044 Error reading key file 'file' - reason

An error occurred while opening or reading from a file specified with /keyfile or the AssemblyKeyFileAttribute.

al1045 Filename 'file' is too long or invalid

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.

al1046 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.

al1047 Error importing file 'file' - reason

A module file cannot be opened for the specified reason.

al1048 Error importing module 'module' of assembly 'assembly' - reason

An error occurred when opening a non-manifest file of a multifile assembly. This error is not emitted directly by al.exe, but can be passed programmatically to a process that uses al.exe.

al1049 Cannot auto-generate build and revision version numbers for dates previous to January 1, 2000

The system clock on your computer is set to a date earlier than January 1, 2000.

al1050 The feature you are using 'old feature' is no longer supported; please use 'new feature' instead

A feature previously supported by al.exe is now obsolete. Use the recommended feature instead.

al1051 Error emitting 'attribute' attribute -'reason'

An assembly custom attribute was not processed by al.exe for the specified reason.

al1052 File 'filename' is not an assembly

The file specified with /template must contain assembly metadata. This error indicates that the file specified by /template did not contain an assembly.

al1053 The version 'version' specified for the 'option' is not in the normal 'major.minor.build.revision' format

al.exe detected ill-formed version information specified with the /fileversion or /productversion options.

al1054 The version 'version' specified for the 'option' is not in the normal 'major.minor.build.revision' format

al.exe detected ill-formed version information specified with the SatelliteContractVersionAttribute.

al1055 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.

If an assembly has a strong name, it can be installed in the global assembly cache. Consequently, referenced assemblies would also need to go into the global assembly cache. Only assemblies with strong names can go into the global assembly cache.

al1056 Referenced assembly 'filename' is a localized satellite assembly

An assembly created using the AssemblyCultureAttribute attribute was referenced in the creation of the current assembly. The AssemblyCultureAttribute attribute indicates the file is a localized satellite assembly and it is not normal to reference a satellite assembly. Reference the main parent assembly instead.

al1057 Executables cannot be localized, Culture should always be empty

An assembly is being created with /target:exe, but /culture was specified. Assemblies in the .exe file cannot have information in the Culture field.

al1058 'file' is an assembly and cannot be added as a module

In a C++ compilation, /assemblymodule (linker option) was passed a file that contained an assembly.

al1059 Unknown error (code)

al.exe received an unknown error code (code).

Possible solutions include:

  • Rebuild the SSCLI.
  • 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.
al1060 Cryptographic failure while creating hashes - reason

An error occurred while creating the file hashes for a multifile assembly.

al1061 Cannot set option 'option' because 'reason'

The value specified for this option is invalid for the specified reason.

See Also

Tools Index | Strong Name Tool (Sn.exe) | Global Assembly Cache Tool (Gacutil.exe)


Copyright (c) 2006 Microsoft Corporation. All rights reserved.