1

我正在尝试为 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)

当我尝试通过此处描述的方法将库直接嵌入到程序集中时,我得到了同样的错误。

是否有任何解决方法可以将 .NET 依赖关系交付给 CRM?还是唯一的方法是将其放入服务器上的 GAC 中?

4

0 回答 0