ILMerge Properties

MSBuild Extension Pack

ILMerge Properties MSBuild Extension Pack Help 4.0.12.0

The ILMerge type exposes the following members.

Properties

  Name Description
Public property AllowDuplicateResources
AllowDuplicateResources
Public property AllowDuplicateTypes
Allows the user to either allow all public types to be renamed when they are duplicates, or to specify it for arbitrary type names

Command line option: [/allowDup[:typeName]]*

Default: no duplicates of public types allowed.

Public property AllowMultipleAssemblyLevelAttributes
If set, any assembly-level attributes names that have the same type are copied over into the target directory as long as the definition of the attribute type specifies that “AllowMultiple” is true.

Command line option: /allowMultiple

Default: false

Public property AllowZeroPeKind
When this is set before calling Merge, then if an assembly's PeKind flag (this is the value of the field listed as .corflags in the Manifest) is zero it will be treated as if it was ILonly.

This can be used to allow C++ assemblies to be merged; it does not appear that the C++ compiler writes the value as ILonly.

However, if such an assembly has any non-IL features, then they will probably not be copied over into the target assembly correctly.

So please use this option with caution.

Command line option: /zeroPeKind

Default: false

Public property AttributeFile
If this is set before calling Merge, then it specifies the path and filename to an atttribute assembly, an assembly that will be used to get all of the assembly-level attributes such as Culture, Version, etc.

It will also be used to get the Win32 Resources from. It is mutually exclusive with the CopyAttributes property (Section 2.7).

When it is not specified, then the Win32 Resources from the primary assembly are copied over into the target assembly.

If it is not a full path, then the current directory is used.

Command line option: /attr:filename

Default: null

Public property Closed
When this is set before calling Merge, then the "transitive closure" of the input assemblies is computed and added to the list of input assemblies.

An assembly is considered part of the transitive closure if it is referenced, either directly or indirectly, from one of the originally

specified input assemblies and it has an external reference to one of the input assemblies, or one of the assemblies that has such a reference.

Command line option: /closed

Default: false

Public property CopyAttributes
When this is set before calling Merge, then the assembly level attributes of each input assembly are copied over into the target assembly.

Any duplicate attribute overwrites a previously copied attribute. If you want to allow duplicates (for those attributes whose type specifies “AllowMultiple” in their definition), then you can also set the AllowMultipleAssemblyLevelAttributes.

The input assemblies are processed in the order they are specified. This option is mutually exclusive with specifying an attribute assembly, i.e., the property AttributeFile.

When an attribute assembly is specified, then no assembly-level attributes are copied over from the input assemblies

Command line option: /copyattrs

Default: false

Public property DebugInfo
When this is set to true, ILMerge creates a .pdb file for the output assembly and merges into it any .pdb files found for input assemblies.

If you do not want a .pdb file created for the output assembly, either set this property to false or else specify the /ndebug option at the command line.

Command line option: /ndebug

Default: true

Public property DelaySign
When this is set before calling Merge, then the target assembly will be delay signed. This can be set only in conjunction with the /keyfile option (Section 2.13).

Command line option: /delaysign

Default: null

Public property DeleteInputAssemblies
Set to true to delete the InputAssemblies after the merged file has been created. Default is false;
Public property ExcludeFile
This property is used only in conjunction with the Internalize property (Section 2.12). When this is set before calling Merge, it indicates

the path and filename that will be used to identify types that are not to have their visibility modified.

If Internalize is true, but ExcludeFile is "", then all types in any assembly other than the primary assembly are made non-public.

Setting this property implicitly sets Internalize to true. The contents of the file should be one regular expression per line.

The syntax is that defined in the .NET namespace System.Text.RegularExpressions for regular expressions.

The regular expressions are matched against each type's full name, e.g., "System.Collections.IList".

If the match fails, it is tried again with the assembly name (surrounded by square brackets) prepended to the type name.

Thus, the pattern “\[A\].*” excludes all types in assembly A from being made non-public. (The backslashes are required because the string is treated as a regular expression.)

The pattern “N.T” will match all types named T in the namespace named N no matter what assembly they are defined in.

It is important to note that the regular expressions are not anchored to the beginning of the string; if this is desired, use the appropriate regular expression operator characters to do so.

Command line option: /internalize[:excludeFile]

Default: null

Public property FileAlignment
This controls the file alignment used for the target assembly. The setter sets the value to the largest power of two that is no larger than the supplied argument, and is at least 512.

Command line option: /align:n

Default: 512

Public property InputAssemblies
Sets the input assemblies to merge.
Public property Internalize
This controls whether types in assemblies other than the primary assembly have their visibility modified. When it is true, then all non-exempt types that are visible outside of their assembly

have their visibility modified so that they are not visible from outside of the merged assembly. A type is exempt if its full name matches a line from the ExcludeFile (Section 2.10) using the .NET regular expression engine.

Command line option: /internalize[:excludeFile]

Default: false

Public property KeyFile
When this is set before calling Merge, it specifies the path and filename to a .snk file. The target assembly will be signed with its contents and will

then have a strong name. It can be used with the DelaySign property (Section 2.9) to have the target assembly delay signed.

This can be done even if the primary assembly was fully signed.

Command line option: /keyfile:filename

Default: null

Public property LogFile
When this is set before calling Merge, it indicates the path and filename that log messages are written to. If LogMessages is true, but LogFile is null, then log messages are written to Console.Out.

Command line option: /log[:logfile]

Default: null

Public property LogMessages
When this is set before calling Merge, then log messages are written. It is used in conjunction with the LogFile property.

If Log is true, but LogFile is null, then log messages are written to Console.Out. To specify this behavior on the command line, the option "/log" can be given without a log file.

Command line option: /log[:logfile]

Default: false

Public property OutputFile
This must be set before calling Merge. It specifies the path and filename that the target assembly will be written to.

Command line option: /out:filename

Default: null

Public property PublicKeyTokens
This must be set before calling Merge. It indicates whether external assembly references in the manifest of the target assembly will use full public keys (false) or public key tokens (true).

Command line option: /out:filename

Default: true

Public property SearchDirectories
Sets the directories to be used to search for input assemblies. Each item should contain a directory name.

Command line option: /lib:directory

Public property StrongNameLost
Once merging is complete, this property is true if and only if the primary assembly had a strong name, but the target assembly does not.

This can occur when an .snk file is not specified, or if something goes wrong trying to read its contents.

Public property TargetKind
This controls whether the target assembly is created as a library, a console application or as a Windows application. When it is not specified, then the target

assembly will be the same kind as that of the primary assembly. (In that case, the file extensions found on the specified target assembly and the primary

assembly must match.) When it is specified, then the file extension of the target assembly must match the specification. The possible values are ILMerge.Kind.{Dll, Exe, WinExe}

Command line option: /target:(library|exe|winexe)

Default: ILMerge.Kind.SameAsPrimaryAssembly

Public property TargetPlatformDirectory
This method sets the .NET Framework for the target assembly to be the one specified by platform. Valid strings for the first argument are "v1", "v1.1", "v2", and "v4".

The "v" is case insensitive and is also optional. This way ILMerge can be used to "cross-compile", i.e., it can run in one version of the framework and generate

the target assembly so it will run under a different assembly. The second argument is the directory in which mscorlib.dll is to be found.

Command line option: /targetplatform:version,platformdirectory

Default: null

Public property TargetPlatformVersion
This method sets the .NET Framework for the target assembly to be the one specified by platform. Valid strings for the first argument are "v1", "v1.1", "v2", and "v4".

The "v" is case insensitive and is also optional. This way ILMerge can be used to "cross-compile", i.e., it can run in one version of the framework and generate

the target assembly so it will run under a different assembly. The second argument is the directory in which mscorlib.dll is to be found.

Command line option: /targetplatform:version,platformdirectory

Default: null

Public property UnionMerge
When this is true, then types with the same name are all merged into a single type in the target assembly. The single type is the union of all of the individual

types in the input assemblies: it contains all of the members from each of the corresponding types in the input assemblies. It cannot be specified at the same time as /allowDup.

Command line option: /union

Default: false

Public property Version
When this has a non-null value, then the target assembly will be given its value as the version number of the assembly. When specified on the command line, the

version is read in as a string and should look like "6.2.1.3" (but without the quote marks). The version must be a valid assembly version as defined by the attribute AssemblyVersion in the System.Reflection namespace.

Command line option: /ver:version

Default: null

Public property XmlDocs
This property controls whether XML documentation files are merged to produce an XML documentation file for the target assembly.

Command line option: /xmldocs

Default: false

Top
See Also

Reference