views:

46

answers:

1

Has anyone had this error with IlMerge? I am trying to merge a few assemblies for a .NET project using the 4.0 Framework.

ILMerge /log /lib:..\Libraries /targetplatform:v4 /internalize:..\SolutionFiles\CJCommon.exclude /ndebug /out:bin\Release\Common.dll obj\Release\Common.dll C:\Development\CJCommon\Libraries\FluentNHibernate.dll C:\Development\CJCommon\Libraries\HibernatingRhinos.Profiler.Appender.dll C:\Development\CJCommon\Libraries\Iesi.Collections.dll C:\Development\CJCommon\Libraries\log4net.dll C:\Development\CJCommon\Libraries\Microsoft.Practices.ServiceLocation.dll C:\Development\CJCommon\Libraries\NHibernate.ByteCode.Castle.dll C:\Development\CJCommon\Libraries\NHibernate.dll C:\Development\CJCommon\Libraries\NHibernate.Linq.dll C:\Development\CJCommon\Libraries\StructureMap.dll

Set platform to 'v4', using directory 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727..\v4.0.20107' for mscorlib.dll

An exception occurred during merging:

Object reference not set to an instance of an object.

 at System.Compiler.CoreSystemTypes.GetSystemAssembly(Boolean doNotLockFile, Boolean getDebugInfo)
 at System.Compiler.CoreSystemTypes.Initialize(Boolean doNotLockFile, Boolean getDebugInfo)
 at System.Compiler.SystemTypes.Initialize(Boolean doNotLockFile, Boolean getDebugInfo)
 at ILMerging.ILMerge.Merge()
 at ILMerging.ILMerge.Main(String[] args)

C:\Program Files (x86)\MSBuild\Ilmerge.CSharp.targets(8,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft\Ilmerge\Ilmerge.exe" /log /lib:"..\Libraries" /targetplatform:v4 /internalize:./.exited with code 1...

...

========== Rebuild All: 3 succeeded, 1 failed, 0 skipped ==========

+1  A: 

Include the path to the 4.0 Framework in your targetplatform and be sure to use quotes. For example, from PowerShell:

.\ILMerge /out:Merged.dll /targetplatform:'v4,C:\Windows\Microsoft.NET\Framework\v4.0.30319' .\Assembly1.dll .\Assembly2.dll
Sam Pearson