2010-06-24 83 views
4

有沒有人有IlMerge這個錯誤?我正在嘗試使用4.0框架合併.NET項目的幾個程序集。構建ILMerge錯誤

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

使用目錄'C:\ Windows \ Microsoft.NET \ Framework64 \ v'將平臺設置爲'v4' 2.0.50727 .. \ v4.0.20107' 的mscorlib.dll中

合併過程中發生了異常:

對象引用不設置爲一個對象的一個​​實例。

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):錯誤MSB3073:命令 「」 C:\ Program Files文件(x86)的\微軟\ Ilmerge \ Ilmerge .EXE 「/日誌/lib:"..\Libraries」/上投放:V4 /internalize:./.exited代碼爲1 ...

...

======== ==全部重建:3次成功,1次失敗,0次跳過==========

+0

[ILMerge問題錯誤代碼1]的可能重複(http://stackoverflow.com/questions/10130379/ilmerge-issue-error-code-1) – Veverke 2017-05-15 14:14:19

回答

11

在目標平臺中包含4.0 Framework的路徑,並確保使用引號。例如,從PowerShell:

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