带有参考的插件不适用于 CRM 2011
我创建了一个插件并使用了对我创建的另一个项目(DLL)的引用。问题是当我尝试运行该插件时,我收到一条 CRM 错误:
无法加载文件或程序集“XXX,Version=1.0.0.0,Culture=neutral,PublicKeyToken=a760feb9ec7271a9”或其依赖项之一。系统找不到指定的文件。
有人对解决这个问题有任何想法吗?
I have created a plugin and used a reference to another project (DLL) I have created. The problem is when I try to run the plugin, I get a CRM error saying:
Could not load file or assembly 'XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a760feb9ec7271a9' or one of its dependencies. The system cannot find the file specified.
Does anyone have any idea on solving this one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您必须将引用的程序集部署到 GAC 或将其与您的 GAC 合并(使用 ILMerge)
另请参阅 http://msdn.microsoft.com/en-us/library/gg309620.aspx 和 创建单个 CRM 插件 DLL 以存储在CRM数据库
You have to deploy the referenced assembly either to the GAC or merge it with your one (with ILMerge)
See also http://msdn.microsoft.com/en-us/library/gg309620.aspx and Creating a single CRM plugin DLL to store in the CRM database
我在这里有一篇博客文章,介绍如何将所有内容放入 1 个 DLL 中,无需 ILMerge:
CRM2011 插件中的所有引用< /a>.自从我们开始这样做以来,我们还没有遇到过 dll 问题。
请注意,此方法排除了沙盒模式的使用(即,如果您需要插件在 Dynamics CRM Online 中工作,您将无法使用此方法)。
I have a blog post here on how you can put it all in 1 DLL without ILMerge:
All References within CRM2011 plugin. We've yet to have a dll issue since we started doing this.
NB this approach rules out the use of Sandboxed mode (i.e., you will not be able to use this approach should you require your plugin to work in Dynamics CRM Online).
在过去的 6 个月里,我们已经多次遇到此错误,尽管我或其他开发人员盲目地发誓不会出现这种情况,但每次都证明是 DLL 版本问题。
您要将插件安装到磁盘、DB 还是 GAC 上吗?
如果安装到 GAC,我相信外部 DLL 也会进入 GAC。
如果安装到数据库或磁盘,我相信 DLL 会放在 \ assembly \ bin 文件夹中。
We have had this error several times over the last 6 months and each time, despite me or the other developers swearing blind it would not be the case, it has turned out to be a DLL version problem.
Are you installing the plugin to disk, DB or GAC?
If installing to the GAC, I believe external DLLs go in the GAC as well.
If installing to the DB or to disk, I believe DLLs go in the \assembly\bin folder.
有时反病毒会阻止 ASP.NET 访问文件或程序集,我建议您尝试使用强名称对程序集进行签名并将其添加到 GAC:在这里您可以找到更多信息 http://support.microsoft.com/kb/815808
Sometimes the Anti-Virus will prevent ASP.NET from accessing file or assembly, I suggest you try to sign the assembly with strong name and add it to GAC: Here you can find more information http://support.microsoft.com/kb/815808