I think you're looking for the 'exclude' parameter for the /internalize
switch. For example, if you use
/internalize:excludes.txt
where the file excludes.txt
contains
three.dll
it will internalize one.dll
and two.dll
but leave three.dll
as an external dependancy.
Here are a couple of blog posts that go into further detail:
Update: From the documentation:
2.10 ExcludeFile
public string ExcludeFile { get; set; }
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.
2.12 Internalize
public bool Internalize { get; set; }
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.
three.dll
there (or somewhere else where ILMerge can see it), but that won't automatically mean it's merged as well.