ILMerge is an invaluable tool from Michael Barnett at Microsoft Research that can merge multiple assemblies together into a single assembly.

ILMerge can output .NET 2.0 or .NET 1.1 assemblies by using the /targetplatform:v1.1 switch.

At the time of writing v2.8.0626 (26th June 08) has a little problem when targeting .NET 1.1 and running on 64bit Vista.

In the log files you see this when running on x86

Set platform to 'v1.1', using directory
'C:WindowsMicrosoft.NETFrameworkv2.0.50727..v1.1.4322' for mscorlib.dll

But on x64

Set platform to 'v1.1', using directory
'C:WindowsMicrosoft.NETFramework64v2.0.50727..v1.1.4322'
for mscorlib.dll

But there is no such dir – .NET 1.1 is only 32bit (though obviously it runs on x64 systems) and the correct dir is

C:WindowsMicrosoft.NETFrameworkv1.1.4322

As a result you will see the following in the log file.

AssemblyResolver: Assembly 'System.Web' is referencing assembly 'System'.
AssemblyResolver: Attempting referencing assembly's directory.
AssemblyResolver: Did not find assembly in referencing assembly's directory.
AssemblyResolver: Attempting input directory.
AssemblyResolver: Did not find assembly in input directory.
AssemblyResolver: Attempting user-supplied directories.
AssemblyResolver: Did not find assembly in user-supplied directories.
....
Could not resolve type reference: [mscorlib]System.Enum.
Could not resolve type reference: [mscorlib]System.ValueType.
Could not resolve type reference: [mscorlib]System.Object.
Could not resolve type reference: [mscorlib]System.IDisposable.
....
(Missed out a few hundred lines referencing all other mscorlib etc namespaces)
ILMerge: Done.

And although it reports done and does not return an error code you will get assembly loading errors.
Workaround

Add a symlink (a sort of low level shortcut) directing ILMerge to the correct directory.

MKLINK /D C:WindowsMicrosoft.NETFramework64v1.1.4322
C:WindowsMicrosoft.NETFrameworkv1.1.4322

Tags: ,

1 Comment on ILMerge /targetplatform:v1.1 and Vista x64

  1. Maurizio says:

    Great article.
    I had the exact problem, and solved with the symlink.

    Many thanks guy.
    Maurizio.

Leave a Reply

Anti-Spam Quiz: