Arne said:
If the code exists in the form of netmodules then you can
do something. [...]
What can be used to merge modules? I know you can create a multi-file
assembly, but that's just a placeholder assembly that refers to the
individual module files. Is there a way to get all the module files into
the same assembly?
Yes.
Use link instead of al.
Requires .NET 2.0.
Arne
I have been trying to solve this but no luck. Let me explain what I
have:
I am using ILMerge to merge the following files: Build.exe,
FlyOnDreams.Net.dll and Ionic.Zip.dll.
- Build.exe > Net 4.0 Console Application
- FlyOnDreams.Net.dll > Net 4.0 Library. It contains classes with
helpers methods.
It depends only on NET Framework
libraries.
- Ionic.Zip.dll > A Net Zip library (
http://dotnetzip.codeplex.com/)
I used the following config file (From ILMerge site):
<?xml version ="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<requiredRuntime safemode="true" imageVersion="v4.0.30319"
version="v4.0.30319"/>
</startup>
</configuration>
And the following Windows Batch File:
ILMerge /log:ILMerge.log /target:exe /out:BuildMerged.exe Build.exe
FlyOnDreams.Net.dll Ionic.Zip.dll
The BuildMerged.exe is built successfully but it crashes when I run
it.
I debugged it and get the following error:
Could not load type 'System.Func`2' from assembly 'mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
I checked the Log and I think the problem might be here:
“Location for referenced assembly 'System.Core' is 'C:\Windows
\Microsoft.Net\assembly\GAC_MSIL\System.Core
\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'
There were errors reported in System.Core's metadata.
Could not resolve type reference: [mscorlib]System.Func`2.
Could not resolve type reference: [mscorlib]System.Func`3.
Could not resolve type reference:
[System]System.Collections.Generic.ISet`1.
Location for referenced assembly 'System' is 'C:\Windows
\Microsoft.NET\Framework64\v2.0.50727\System.dll'
There were no errors reported in System's metadata.
Location for referenced assembly 'System.Drawing' is 'C:\Windows
\Microsoft.NET\Framework64\v2.0.50727\System.Drawing.dll'
There were no errors reported in System.Drawing's metadata.
Location for referenced assembly 'System.Data.Entity' is 'C:\Windows
\Microsoft.Net\assembly\GAC_MSIL\System.Data.Entity
\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Entity.dll'
There were errors reported in System.Data.Entity's metadata.
Could not resolve type reference:
[mscorlib]System.Runtime.TargetedPatchingOptOutAttribute.
Could not resolve member reference:
System.Runtime.TargetedPatchingOptOutAttribute::.ctor.
ILMerge: Done.”
I am using ILMerge version 2.10.0526. The latest version.
But again, the Merged File is created, and in log I read
“ILMerge
![Big Grin :D :D](/styles/default/custom/smilies/grin.gif)
one”.
What might be wrong?
Finally, here it is the full log:
ILMerge version 2.10.526.0
Copyright (C) Microsoft Corporation 2004-2006. All rights reserved.
ILMerge /log:ILMerge.log /target:exe /out:BuildMerged.exe Build.exe
FlyOnDreams.Net.dll Ionic.Zip.dll
Set platform to 'v2', using directory 'C:\Windows\Microsoft.NET
\Framework64\v4.0.30319\..\v2.0.50727' for mscorlib.dll
Running on Microsoft (R) .NET Framework v4.0.30319
mscorlib.dll version = 4.0.0.0
The list of input assemblies is:
Build.exe
FlyOnDreams.Net.dll
Ionic.Zip.dll
Trying to read assembly from the file 'C:\Users\Miguel\Projects\Fly On
Dreams\Architecture\Client\Project\Build.exe'.
Successfully read in assembly.
There were no errors reported in Build's metadata.
Trying to read assembly from the file 'C:\Users\Miguel\Projects\Fly On
Dreams\Architecture\Client\Project\FlyOnDreams.Net.dll'.
Can not find PDB file. Debug info will not be available for assembly
'FlyOnDreams.Net.dll'.
Successfully read in assembly.
There were no errors reported in FlyOnDreams.Net's metadata.
Trying to read assembly from the file 'C:\Users\Miguel\Projects\Fly On
Dreams\Architecture\Client\Project\Ionic.Zip.dll'.
Can not find PDB file. Debug info will not be available for assembly
'Ionic.Zip.dll'.
Successfully read in assembly.
There were no errors reported in Ionic.Zip's metadata.
Checking to see that all of the input assemblies have a compatible
PeKind.
Build.PeKind = ILonly, Requires32bits
FlyOnDreams.Net.PeKind = ILonly
Ionic.Zip.PeKind = ILonly
All input assemblies have a compatible PeKind value.
AssemblyResolver: Assembly 'FlyOnDreams.Net' 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: No user-supplied directories.
AssemblyResolver: Attempting framework directory.
Can not find PDB file. Debug info will not be available for assembly
'System'.
Resolved assembly reference 'System' to 'C:\Windows\Microsoft.NET
\Framework64\v4.0.30319\..\v2.0.50727\System.dll'. (Used framework
directory.)
AssemblyResolver: Assembly 'FlyOnDreams.Net' is referencing assembly
'System.Drawing'.
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: No user-supplied directories.
AssemblyResolver: Attempting framework directory.
Can not find PDB file. Debug info will not be available for assembly
'System.Drawing'.
Resolved assembly reference 'System.Drawing' to 'C:\Windows
\Microsoft.NET\Framework64\v4.0.30319\..
\v2.0.50727\System.Drawing.dll'. (Used framework directory.)
AssemblyResolver: Assembly 'FlyOnDreams.Net' is referencing assembly
'System.Data.Entity'.
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: No user-supplied directories.
AssemblyResolver: Attempting framework directory.
AssemblyResolver: Did not find assembly in framework directory.
AssemblyResolver: Unable to resolve reference. (It still might be
found, e.g., in the GAC.)
Merging assembly 'Build' into target assembly.
Merging assembly 'FlyOnDreams.Net' into target assembly.
Merging assembly 'Ionic.Zip' into target assembly.
Merging assembly-level attributes from assembly 'Build' into target
assembly.
Copying 2 Win32 Resources from assembly 'Build' into target assembly.
Transferring entry point 'Build.Program.Main(System.String[])' from
assembly 'Build' to assembly 'BuildMerged'.
There were no errors reported in the target assembly's metadata.
ILMerge: Writing target assembly 'BuildMerged.exe'.
AssemblyResolver: Assembly 'Build' is referencing assembly
'System.Core'.
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: No user-supplied directories.
AssemblyResolver: Attempting framework directory.
AssemblyResolver: Did not find assembly in framework directory.
AssemblyResolver: Unable to resolve reference. (It still might be
found, e.g., in the GAC.)
Location for referenced assembly 'mscorlib' is 'C:\Windows
\Microsoft.NET\Framework64\v2.0.50727\mscorlib.dll'
There were no errors reported in mscorlib's metadata.
Location for referenced assembly 'System.Core' is 'C:\Windows
\Microsoft.Net\assembly\GAC_MSIL\System.Core
\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'
There were errors reported in System.Core's metadata.
Could not resolve type reference: [mscorlib]System.Func`2.
Could not resolve type reference: [mscorlib]System.Func`3.
Could not resolve type reference:
[System]System.Collections.Generic.ISet`1.
Location for referenced assembly 'System' is 'C:\Windows\Microsoft.NET
\Framework64\v2.0.50727\System.dll'
There were no errors reported in System's metadata.
Location for referenced assembly 'System.Drawing' is 'C:\Windows
\Microsoft.NET\Framework64\v2.0.50727\System.Drawing.dll'
There were no errors reported in System.Drawing's metadata.
Location for referenced assembly 'System.Data.Entity' is 'C:\Windows
\Microsoft.Net\assembly\GAC_MSIL\System.Data.Entity
\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Entity.dll'
There were errors reported in System.Data.Entity's metadata.
Could not resolve type reference:
[mscorlib]System.Runtime.TargetedPatchingOptOutAttribute.
Could not resolve member reference:
System.Runtime.TargetedPatchingOptOutAttribute::.ctor.
ILMerge: Done.
Thank You,
Miguel Moura