Build with ILMerge Error

Has anyone had this error with IlMerge? I am trying to combine multiple 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

Install the platform on "v4" using the directory "C: \ Windows \ Microsoft.NET \ Framework64 \ v2.0.50727 .. \ v4.0.20107 'for mscorlib.dll

An exception occurred during the merge:

The reference to the object is not installed in the instance of the 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: command "C: \ Program Files (x86) \ Microsoft \ Ilmerge \ Ilmerge.exe" / log / lib: " .. \ Libraries "/ targetplatform: v4 / internalize: ./. Exited with code 1 ...

...

========== Rebuild everything: 3 successfully, 1 failed, 0 skipped ==========

+4
source share
1 answer

Include the path to the 4.0 Framework in your target platform and be sure to use quotation marks. For example, from PowerShell:

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

Source: https://habr.com/ru/post/1313716/


All Articles