2011-08-04 49 views
1

有沒有人成功地將它們的組裝與NHibernate v3.0合併?ILMerge與NHIbernate的困境

下面的命令不工作(抱怨組件)

..\Tools\ILMerge /log:"merge.txt" 
    /lib:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5" 
    /lib:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0" 
out:SharpArchitecture.dll lib\NHibernate.Validator.dll "lib\Fluent NHibernate\NHibernate.dll" 
/keyfile:"SharpArch.Core\SharpArch.snk" 

它需要針對3.5框架,以便它可以在運行的SharePoint。

這裏的日誌

ILMerge version 2.11.502.0 
Copyright (C) Microsoft Corporation 2004-2006. All rights reserved. 
ILMerge /log:merge.txt /lib:C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5 /lib:C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0 /out:SharpArchitecture.dll lib\NHibernate.Validator.dll lib\Fluent NHibernate\NHibernate.dll /keyfile:SharpArch.Core\SharpArch.snk 
Set platform to 'v2', using directory 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\..\v2.0.50727' for mscorlib.dll 
Running on Microsoft (R) .NET Framework v2.0.50727 
mscorlib.dll version = 2.0.0.0 
The list of input assemblies is: 
    lib\NHibernate.Validator.dll 
    lib\Fluent NHibernate\NHibernate.dll 
Trying to read assembly from the file 'C:\Dev\Dev\2010\Shared Libraries\Third Party\Sharp Architecture\lib\NHibernate.Validator.dll'. 
Can not find PDB file. Debug info will not be available for assembly 'lib\NHibernate.Validator.dll'. 
    Successfully read in assembly. 
    There were no errors reported in NHibernate.Validator's metadata. 
Trying to read assembly from the file 'C:\Dev\Dev\2010\Shared Libraries\Third Party\Sharp Architecture\lib\Fluent NHibernate\NHibernate.dll'. 
    Successfully read in assembly. 
    There were no errors reported in NHibernate's metadata. 
Checking to see that all of the input assemblies have a compatible PeKind. 
    NHibernate.Validator.PeKind = ILonly 
    NHibernate.PeKind = ILonly 
All input assemblies have a compatible PeKind value. 
AssemblyResolver: Assembly 'NHibernate.Validator' is referencing assembly 'NHibernate'. 
    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. 
    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.) 
AssemblyResolver: Assembly 'NHibernate.Validator' 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. 
Resolved assembly reference 'System.Core' to 'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll'. (Used a client-supplied directory.) 
Can not find PDB file. Debug info will not be available for assembly 'System.Core'. 
AssemblyResolver: Assembly 'NHibernate.Validator' is referencing assembly 'log4net'. 
    AssemblyResolver: Attempting referencing assembly's directory. 
Can not find PDB file. Debug info will not be available for assembly 'log4net'. 
Resolved assembly reference 'log4net' to 'C:\Dev\Dev\2010\Shared Libraries\Third Party\Sharp Architecture\lib\log4net.dll'. (Used referencing Module's directory.) 
AssemblyResolver: Assembly 'NHibernate' is referencing assembly 'Iesi.Collections'. 
    AssemblyResolver: Attempting referencing assembly's directory. 
Resolved assembly reference 'Iesi.Collections' to 'C:\Dev\Dev\2010\Shared Libraries\Third Party\Sharp Architecture\lib\Fluent NHibernate\Iesi.Collections.dll'. (Used referencing Module's directory.) 
AssemblyResolver: Assembly 'NHibernate' is referencing assembly 'System.ServiceModel'. 
    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. 
Resolved assembly reference 'System.ServiceModel' to 'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.ServiceModel.dll'. (Used a client-supplied directory.) 
Can not find PDB file. Debug info will not be available for assembly 'System.ServiceModel'. 
AssemblyResolver: Assembly 'NHibernate' is referencing assembly 'System.Transactions'. 
    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. 
    AssemblyResolver: Attempting framework directory. 
Can not find PDB file. Debug info will not be available for assembly 'System.Transactions'. 
Resolved assembly reference 'System.Transactions' to 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\..\v2.0.50727\System.Transactions.dll'. (Used framework directory.) 
Using assembly 'NHibernate.Validator' for assembly-level attributes for the target assembly. 
Merging assembly 'NHibernate.Validator' into target assembly. 
Assembly level attribute 'System.Security.AllowPartiallyTrustedCallersAttribute' from assembly 'NHibernate.Validator' being deleted from target assembly 
Merging assembly 'NHibernate' into target assembly. 
Duplicate type name: modifying name of the type '<>f__AnonymousType0`2' (from assembly 'NHibernate') to 'NHibernate.<>f__AnonymousType0`2' 
Duplicate type name: modifying name of the type '<>f__AnonymousType1`2' (from assembly 'NHibernate') to 'NHibernate.<>f__AnonymousType1`2' 
Duplicate type name: modifying name of the type '<>f__AnonymousType2`2' (from assembly 'NHibernate') to 'NHibernate.<>f__AnonymousType2`2' 
Duplicate type name: modifying name of the type '<>f__AnonymousType3`2' (from assembly 'NHibernate') to 'NHibernate.<>f__AnonymousType3`2' 
Duplicate type name: modifying name of the type '<>f__AnonymousType4`2' (from assembly 'NHibernate') to 'NHibernate.<>f__AnonymousType4`2' 
Assembly level attribute 'System.Security.AllowPartiallyTrustedCallersAttribute' from assembly 'NHibernate' being deleted from target assembly 
Copying 1 Win32 Resources from assembly 'NHibernate.Validator' into target assembly. 
ILMerge: Signing assembly with the key file 'SharpArch.Core\SharpArch.snk'. 
    There were no errors reported in the target assembly's metadata. 
ILMerge: Writing target assembly 'SharpArchitecture.dll'. 
An exception occurred during merging: 
Unresolved assembly reference not allowed: NHibernate. 
    at System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode assembly) 
    at System.Compiler.Ir2md.GetTypeRefIndex(TypeNode type) 
    at System.Compiler.Ir2md.VisitReferencedType(TypeNode type) 
    at System.Compiler.Ir2md.VisitMethodCall(MethodCall call) 
    at System.Compiler.Ir2md.VisitAssignmentStatement(AssignmentStatement assignment) 
    at System.Compiler.Ir2md.VisitBlock(Block block) 
    at System.Compiler.Ir2md.VisitBlock(Block block) 
    at System.Compiler.Ir2md.VisitMethodBody(Method method) 
    at System.Compiler.Ir2md.VisitMethod(Method method) 
    at System.Compiler.Ir2md.VisitClass(Class Class) 
    at System.Compiler.Ir2md.VisitModule(Module module) 
    at System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation) 
    at System.Compiler.Ir2md.WritePE(Module module, String debugSymbolsLocation, BinaryWriter writer) 
    at System.Compiler.Writer.WritePE(String location, Boolean writeDebugSymbols, Module module, Boolean delaySign, String keyFileName, String keyName) 
    at System.Compiler.Writer.WritePE(CompilerParameters compilerParameters, Module module) 
    at ILMerging.ILMerge.Merge() 
    at ILMerging.ILMerge.Main(String[] args) 
+1

什麼是根本問題?你爲什麼試圖合併NHibernate(和其他的DLL)? NHibernate已經運行在.NET 3.5上。 Sharepoint如何參與? –

+0

潛在的問題是有一個萬億的dll在gac註冊sharepoint - 維護需要引用它們的web.configs的負載。當你將NH,Sharp Architecture和我們自己的項目之間的依賴性加起來時,有很多。爲什麼要寫ILMerge?我已經提到3.5作爲它的共同點 - 有關如何定位不相關的v4的帖子 –

回答

0

嘗試此語法代替:

ILMerge.exe /log:"merge.txt" /lib:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5" /lib:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0" /lib:"FullPathToNHibernate" /lib:"FullPathToFluent NHibernate" /out:SharpArchitectureMerged.dll SharpArchitecture.dll NHibernate.Validator.dll NHibernate.dll /keyfile:"SharpArch.Core\SharpArch.snk" 

基本上,
1.通行證的輸出組件輸入/輸出
2.主組件是第一參數在/ out開關後 3.使用/ lib開關傳遞完整的庫路徑

OR您可以提供引用的程序集的完整文件路徑是這樣的:

ILMerge.exe /log:"merge.txt" /lib:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5" /lib:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0" /out:SharpArchitectureMerged.dll SharpArchitecture.dll "FullPathToNHibernate\NHibernate.Validator.dll" "FullPathToFluent NHibernate\NHibernate.dll" /keyfile:"SharpArch.Core\SharpArch.snk" 

我在想,你的當前目錄不能解決的部分路徑參考等

NHibernate的。 Validator.dll也可能正在尋找特定的強命名版本的NHibernate.dll。