Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Merge multiple .NET 4.5.2 projects using ILMerge - Plugin - System.BadImageFormatException - CRM 2015

$
0
0

I get the following error (translation below) when I try to register a plugin the references also some other projects (.net 4.5.2-any cpu and signed) and assemblies with the Plugin registration Tool (x64).

Before that, I have to ilmerge them with this command (tried all of them):

Framework
ILMerge.exe /out:"FrictionPlugin.merged.dll" "MyNS.CRM.Friction.Plugin.dll" "MyNS.CRM.Friction*.dll" /target:library /targetplatform:v4,C:\Windows\Microsoft.NET\Framework\v4.0.30319 /wildcards /allowDup /copyattrs /keyfile:"MyNS.CRM.snk" /log:ilmerge_error.log


Framework64
ILMerge.exe /out:"FrictionPlugin.merged.dll" "MyNS.CRM.Friction.Plugin.dll" "MyNS.CRM.Friction*.dll" /target:library /targetplatform:v4,C:\Windows\Microsoft.NET\Framework64\v4.0.30319 /wildcards /allowDup /copyattrs /keyfile:"MyNS.CRM.snk" /log:ilmerge_error.log

ILMerge.exe /out:"FrictionPlugin.merged.dll" "MyNS.CRM.Friction.Plugin.dll" "MyNS.CRM.Friction*.dll" /target:library /targetplatform:v4,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2" /wildcards /allowDup /copyattrs /keyfile:"MyNS.CRM.snk" /log:ilmerge_error.log

Unhandled Exception: System.BadImageFormatException: Die Datei oder Assembly "file:///C:\Users\..\bin\Debug\MyPlugin.merged.dll" oder eine Abhängigkeit davon wurde nicht gefunden. Im Modul wurde ein Assemblymanifest erwartet.

Translation: The file or assembly "file:..." or a reference could not be found.

The module expected an assembly manifest to be present.

bei System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
bei System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
bei System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
bei System.Reflection.Assembly.LoadFrom(String assemblyFile)
bei Microsoft.Crm.Tools.Libraries.CrmAssemblyReader.LoadAssembly(String path)
bei Microsoft.Crm.Tools.Libraries.CrmAssemblyReader.RetrievePluginsFromAssembly(String path)
bei Microsoft.Crm.Tools.Libraries.CrmAssemblyReader.RetrievePluginsFromAssembly(String path)
bei Microsoft.Crm.Tools.Libraries.RegistrationHelper.RetrievePluginsFromAssembly(String pathToAssembly, String appPath)
bei Microsoft.Crm.Tools.AssemblyRegistration.PluginRegistrationViewModel.BtnLoadAssemblyClicked()

 

Here is the log file (last command of the three above):

ILMerge version 2.12.803.0
Copyright (C) Microsoft Corporation 2004-2006. All rights reserved.
ILMerge /out:FrictionPlugin.merged.dll MyNS.CRM.Friction.Plugin.dll MyNS.CRM.Friction*.dll /target:library /targetplatform:v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2 /wildcards /allowDup /copyattrs /keyfile:MyNS.CRM.snk /log:ilmerge_error.log
Set platform to 'v4', using directory 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2' 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:
MyNS.CRM.Friction.Plugin.dll
MyNS.CRM.Friction*.dll
The number of files matching the pattern MyNS.CRM.Friction.Plugin.dll is 1.
C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\MyNS.CRM.Friction.Plugin.dll
Trying to read assembly from the file 'C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\MyNS.CRM.Friction.Plugin.dll'.
Successfully read in assembly.
There were no errors reported in MyNS.CRM.Friction.Plugin's metadata.
The number of files matching the pattern MyNS.CRM.Friction*.dll is 2.
C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\MyNS.CRM.Friction.Dto.dll
C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\MyNS.CRM.Friction.Plugin.dll
Trying to read assembly from the file 'C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\MyNS.CRM.Friction.Dto.dll'.
Successfully read in assembly.
There were no errors reported in MyNS.CRM.Friction.Dto's metadata.
Trying to read assembly from the file 'C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\MyNS.CRM.Friction.Plugin.dll'.
Successfully read in assembly.
There were no errors reported in MyNS.CRM.Friction.Plugin's metadata.
Checking to see that all of the input assemblies have a compatible PeKind.
MyNS.CRM.Friction.Plugin.PeKind = ILonly
MyNS.CRM.Friction.Dto.PeKind = ILonly
MyNS.CRM.Friction.Plugin.PeKind = ILonly
All input assemblies have a compatible PeKind value.
AssemblyResolver: Assembly 'MyNS.CRM.Friction.Plugin' is referencing assembly 'Microsoft.Xrm.Sdk'.
AssemblyResolver: Attempting referencing assembly's directory.
Can not find PDB file. Debug info will not be available for assembly 'Microsoft.Xrm.Sdk'.
Resolved assembly reference 'Microsoft.Xrm.Sdk' to 'C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\Microsoft.Xrm.Sdk.dll'. (Used referencing Module's directory.)
AssemblyResolver: Assembly 'MyNS.CRM.Friction.Plugin' is referencing assembly 'Microsoft.Xrm.Sdk'.
AssemblyResolver: Attempting referencing assembly's directory.
Can not find PDB file. Debug info will not be available for assembly 'Microsoft.Xrm.Sdk'.
Resolved assembly reference 'Microsoft.Xrm.Sdk' to 'C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\Microsoft.Xrm.Sdk.dll'. (Used referencing Module's directory.)
Merging assembly-level attributes from input assemblies for the target assembly.
Merging assembly 'MyNS.CRM.Friction.Plugin' into target assembly.
Merging assembly 'MyNS.CRM.Friction.Dto' into target assembly.
Merging assembly 'MyNS.CRM.Friction.Plugin' into target assembly.
Duplicate type name: modifying name of the type 'MyNS.CRM.Friction.Plugin.FrictionPlugin' (from assembly 'MyNS.CRM.Friction.Plugin') to 'MyNS.CRM.Friction.Plugin3655.FrictionPlugin'
Duplicate type name: modifying name of the type 'MyNS.CRM.Friction.Plugin.Properties.Settings' (from assembly 'MyNS.CRM.Friction.Plugin') to 'MyNS.CRM.Friction.Plugin.Settings'
Copying 1 Win32 Resources from assembly 'MyNS.CRM.Friction.Plugin' into target assembly.
ILMerge: Signing assembly with the key file 'MyNS.CRM.snk'.
There were no errors reported in the target assembly's metadata.
ILMerge: Writing target assembly 'FrictionPlugin.merged.dll'.
AssemblyResolver: Assembly 'Microsoft.Xrm.Sdk' is referencing assembly 'System.Runtime.Serialization'.
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.Runtime.Serialization'.
Resolved assembly reference 'System.Runtime.Serialization' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Runtime.Serialization.dll'. (Used framework directory.)
AssemblyResolver: Assembly 'Microsoft.Xrm.Sdk' is referencing assembly 'System.Runtime.Serialization'.
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.Runtime.Serialization'.
Resolved assembly reference 'System.Runtime.Serialization' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Runtime.Serialization.dll'. (Used framework directory.)
AssemblyResolver: Assembly 'MyNS.CRM.Friction.Plugin' 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.
Can not find PDB file. Debug info will not be available for assembly 'System.Core'.
Resolved assembly reference 'System.Core' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Core.dll'. (Used framework directory.)
AssemblyResolver: Assembly 'MyNS.CRM.Friction.Plugin' 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.
Can not find PDB file. Debug info will not be available for assembly 'System.Core'.
Resolved assembly reference 'System.Core' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Core.dll'. (Used framework directory.)
AssemblyResolver: Assembly 'System' is referencing assembly 'System.Configuration'.
AssemblyResolver: Attempting referencing assembly's directory.
Can not find PDB file. Debug info will not be available for assembly 'System.Configuration'.
Resolved assembly reference 'System.Configuration' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Configuration.dll'. (Used referencing Module's directory.)
AssemblyResolver: Assembly 'System' is referencing assembly 'System.Configuration'.
AssemblyResolver: Attempting referencing assembly's directory.
Can not find PDB file. Debug info will not be available for assembly 'System.Configuration'.
Resolved assembly reference 'System.Configuration' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Configuration.dll'. (Used referencing Module's directory.)
An exception occurred during merging:
Der Index war außerhalb des Arraybereichs.
bei System.Compiler.Ir2md.PopulateInterfaceImplTable()
bei System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation)
bei System.Compiler.Ir2md.WritePE(Module module, String debugSymbolsLocation, BinaryWriter writer)
bei System.Compiler.Writer.WritePE(String location, Boolean writeDebugSymbols, Module module, Boolean delaySign, String keyFileName, String keyName)
bei System.Compiler.Writer.WritePE(CompilerParameters compilerParameters, Module module)
bei ILMerging.ILMerge.Merge()
bei ILMerging.ILMerge.Main(String[] args)
ILMerge version 2.12.803.0
Copyright (C) Microsoft Corporation 2004-2006. All rights reserved.
ILMerge /out:FrictionPlugin.merged.dll MyNS.CRM.Friction.Plugin.dll MyNS.CRM.Friction*.dll /target:library /targetplatform:v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2 /wildcards /allowDup /copyattrs /keyfile:MyNS.CRM.snk /log:ilmerge_error.log
Set platform to 'v4', using directory 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2' 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:
MyNS.CRM.Friction.Plugin.dll
MyNS.CRM.Friction*.dll
The number of files matching the pattern MyNS.CRM.Friction.Plugin.dll is 1.
C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\MyNS.CRM.Friction.Plugin.dll
Trying to read assembly from the file 'C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\MyNS.CRM.Friction.Plugin.dll'.
Successfully read in assembly.
There were no errors reported in MyNS.CRM.Friction.Plugin's metadata.
The number of files matching the pattern MyNS.CRM.Friction*.dll is 2.
C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\MyNS.CRM.Friction.Dto.dll
C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\MyNS.CRM.Friction.Plugin.dll
Trying to read assembly from the file 'C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\MyNS.CRM.Friction.Dto.dll'.
Successfully read in assembly.
There were no errors reported in MyNS.CRM.Friction.Dto's metadata.
Trying to read assembly from the file 'C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\MyNS.CRM.Friction.Plugin.dll'.
Successfully read in assembly.
There were no errors reported in MyNS.CRM.Friction.Plugin's metadata.
Checking to see that all of the input assemblies have a compatible PeKind.
MyNS.CRM.Friction.Plugin.PeKind = ILonly
MyNS.CRM.Friction.Dto.PeKind = ILonly
MyNS.CRM.Friction.Plugin.PeKind = ILonly
All input assemblies have a compatible PeKind value.
AssemblyResolver: Assembly 'MyNS.CRM.Friction.Plugin' is referencing assembly 'Microsoft.Xrm.Sdk'.
AssemblyResolver: Attempting referencing assembly's directory.
Can not find PDB file. Debug info will not be available for assembly 'Microsoft.Xrm.Sdk'.
Resolved assembly reference 'Microsoft.Xrm.Sdk' to 'C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\Microsoft.Xrm.Sdk.dll'. (Used referencing Module's directory.)
AssemblyResolver: Assembly 'MyNS.CRM.Friction.Plugin' is referencing assembly 'Microsoft.Xrm.Sdk'.
AssemblyResolver: Attempting referencing assembly's directory.
Can not find PDB file. Debug info will not be available for assembly 'Microsoft.Xrm.Sdk'.
Resolved assembly reference 'Microsoft.Xrm.Sdk' to 'C:\Users\myuser\Documents\Visual Studio 2013\Projects\MyNS.CRM.Friction\MyNS.CRM.Friction.Plugin\bin\Debug\Microsoft.Xrm.Sdk.dll'. (Used referencing Module's directory.)
Merging assembly-level attributes from input assemblies for the target assembly.
Merging assembly 'MyNS.CRM.Friction.Plugin' into target assembly.
Merging assembly 'MyNS.CRM.Friction.Dto' into target assembly.
Merging assembly 'MyNS.CRM.Friction.Plugin' into target assembly.
Duplicate type name: modifying name of the type 'MyNS.CRM.Friction.Plugin.FrictionPlugin' (from assembly 'MyNS.CRM.Friction.Plugin') to 'MyNS.CRM.Friction.Plugin3655.FrictionPlugin'
Duplicate type name: modifying name of the type 'MyNS.CRM.Friction.Plugin.Properties.Settings' (from assembly 'MyNS.CRM.Friction.Plugin') to 'MyNS.CRM.Friction.Plugin.Settings'
Copying 1 Win32 Resources from assembly 'MyNS.CRM.Friction.Plugin' into target assembly.
ILMerge: Signing assembly with the key file 'MyNS.CRM.snk'.
There were no errors reported in the target assembly's metadata.
ILMerge: Writing target assembly 'FrictionPlugin.merged.dll'.
AssemblyResolver: Assembly 'Microsoft.Xrm.Sdk' is referencing assembly 'System.Runtime.Serialization'.
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.Runtime.Serialization'.
Resolved assembly reference 'System.Runtime.Serialization' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Runtime.Serialization.dll'. (Used framework directory.)
AssemblyResolver: Assembly 'Microsoft.Xrm.Sdk' is referencing assembly 'System.Runtime.Serialization'.
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.Runtime.Serialization'.
Resolved assembly reference 'System.Runtime.Serialization' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Runtime.Serialization.dll'. (Used framework directory.)
AssemblyResolver: Assembly 'MyNS.CRM.Friction.Plugin' 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.
Can not find PDB file. Debug info will not be available for assembly 'System.Core'.
Resolved assembly reference 'System.Core' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Core.dll'. (Used framework directory.)
AssemblyResolver: Assembly 'MyNS.CRM.Friction.Plugin' 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.
Can not find PDB file. Debug info will not be available for assembly 'System.Core'.
Resolved assembly reference 'System.Core' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Core.dll'. (Used framework directory.)
AssemblyResolver: Assembly 'System' is referencing assembly 'System.Configuration'.
AssemblyResolver: Attempting referencing assembly's directory.
Can not find PDB file. Debug info will not be available for assembly 'System.Configuration'.
Resolved assembly reference 'System.Configuration' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Configuration.dll'. (Used referencing Module's directory.)
AssemblyResolver: Assembly 'System' is referencing assembly 'System.Configuration'.
AssemblyResolver: Attempting referencing assembly's directory.
Can not find PDB file. Debug info will not be available for assembly 'System.Configuration'.
Resolved assembly reference 'System.Configuration' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Configuration.dll'. (Used referencing Module's directory.)
An exception occurred during merging:
Der Index war außerhalb des Arraybereichs.
bei System.Compiler.Ir2md.PopulateInterfaceImplTable()
bei System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation)
bei System.Compiler.Ir2md.WritePE(Module module, String debugSymbolsLocation, BinaryWriter writer)
bei System.Compiler.Writer.WritePE(String location, Boolean writeDebugSymbols, Module module, Boolean delaySign, String keyFileName, String keyName)
bei System.Compiler.Writer.WritePE(CompilerParameters compilerParameters, Module module)
bei ILMerging.ILMerge.Merge()
bei ILMerging.ILMerge.Main(String[] args)


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>