我正在尝试为Dynamics CRM 2011开发自定义工作流活动,但我需要在我的操作中使用第三方库,让我们说Newtonsoft.Json
。
但是当我尝试上传与ILMerge结合的程序集时,我得到以下内容:
Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'file:///d:\Workspace\Application4\Application4\bin\Debug\result.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Microsoft.Crm.Tools.PluginRegistration.AssemblyReader.LoadAssembly(String path)
at Microsoft.Crm.Tools.PluginRegistration.AssemblyReader.RetrievePluginsFromAssembly(String path)
at Microsoft.Crm.Tools.PluginRegistration.AssemblyReader.RetrievePluginsFromAssembly(String path)
at Microsoft.Crm.Tools.PluginRegistration.RegistrationHelper.RetrievePluginsFromAssembly(String pathToAssembly)
at Microsoft.Crm.Tools.PluginRegistration.PluginRegistrationForm.btnLoadAssembly_Click(Object sender, EventArgs e)
当我试图通过描述here的方法将库直接嵌入到汇编中时,我得到了相同的错误。
是否有任何解决方法可以将.NET依赖性提供给CRM?或者唯一的方法是将其放入服务器上的GAC?