Answered by:
Cannot merge microsoft.xrm.client.dll with ILMerge

Question
-
Hi,
I cannot merge microsoft.xrm.client.dll (version 5.0.9689.1985). The error I get from ILMerge is:
An exception occurred during merging: Unresolved assembly reference not allowed: Presentation Framework. at System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode assembly) at .........
ILMerge simplified command is:
ILMerge /target:library /keyfile:WebServiceCaller.key.snk /out:"D:\Dev\out.dll" /targetplatform:v4,C:\Windows\Microsoft.NET\Framework\v4.0.30319 WebServiceCaller.dll
microsoft.xrm.client.dllWhat am I doing wrong and how did you get this dll to merge without errors ?
Thanks for any answers, I need this working ASAP.- Edited by Daniel Hursan Tuesday, April 3, 2012 5:40 AM Forgot a point in title
Tuesday, April 3, 2012 5:39 AM
Answers
-
microsoft.xrm.client.dll is probably going to also have several references of its own that would have to also be included in your command line. You may be entering a real rabbit hole of dependencies by trying to redistribute microsoft.xrm.client.dll. You could try adding the PresentationFramework assembly to your .dll list but I suspect you may continue to find more and more dependencies which may not cleanly resolve with an ILMerge solution. If you can't resolve all the dependencies needed, you may need to review how to re-implement the portions of microsoft.xrm.client.dll that you need.
You may also want to check out this link (referenced by the ILMerge home)for a recommended approach if you are trying to ILMerge WPF-based assemblies. Just remember that this may still give you issues if there are unresolved assembly dependencies at runtime.
- Marked as answer by Daniel Hursan Tuesday, April 3, 2012 4:41 PM
Tuesday, April 3, 2012 4:30 PM
All replies
-
microsoft.xrm.client.dll is probably going to also have several references of its own that would have to also be included in your command line. You may be entering a real rabbit hole of dependencies by trying to redistribute microsoft.xrm.client.dll. You could try adding the PresentationFramework assembly to your .dll list but I suspect you may continue to find more and more dependencies which may not cleanly resolve with an ILMerge solution. If you can't resolve all the dependencies needed, you may need to review how to re-implement the portions of microsoft.xrm.client.dll that you need.
You may also want to check out this link (referenced by the ILMerge home)for a recommended approach if you are trying to ILMerge WPF-based assemblies. Just remember that this may still give you issues if there are unresolved assembly dependencies at runtime.
- Marked as answer by Daniel Hursan Tuesday, April 3, 2012 4:41 PM
Tuesday, April 3, 2012 4:30 PM -
You may be entering a real rabbit hole of dependencies by trying to redistribute microsoft.xrm.client.dll.
Unfortunatey, you are very right about this, just tried it.
"Thanks" to the developers of this microsoft.xrm.client.dll, for wasting my time developing something that is impossible to deploy.My suggestion is for this useless dll to be removed from the Dynamics CRM SDK and from the documentation pages.
I rewrote my code now using QueryExpression, instead of the CrmOrganizationServiceContext and Linq.
Thanks kheiman for your answer! If I only knew this sooner... :)- Edited by Daniel Hursan Tuesday, April 3, 2012 4:41 PM
Tuesday, April 3, 2012 4:40 PM