我有一个使用 MEF 的控制台应用程序。它在本地和部署到开发机器时都可以正常工作。当部署到发布机器时,它会引发组合错误。
开发和发布机器都是虚拟 sql server 2008 r2 机器,具有相同的规格,并且安装了大部分相同的软件和组件。有一个构建和部署过程,但即使将文件从 dev 复制到 release 并运行它们也会导致相同的错误。
发布机器上可能缺少 MEF 的任何先决条件或权限吗?
The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.
1) Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Resulting in: An exception occurred while trying to create an instance of type 'XXX.XXX.Dispatch.EmailDispatcher'.
Resulting in: Cannot activate part 'XXX.XXX.Dispatch.EmailDispatcher'.
Element: Lifetime.CrmBroker.Dispatch.EmailDispatcher --> XXX.XXX.Dispatch.EmailDispatcher --> AssemblyCatalog (Assembly="XXX.XXX, Version=1.1.2264.871, Culture=neutral, PublicKeyToken=null")
Resulting in: Cannot get export 'XXX.XXX.Dispatch.EmailDispatcher (ContractName="XXX.XXX.Dispatch.IEntityTypeDispatcher")' from part 'XXX.XXX.Dispatch.EmailDispatcher'.
Element: XXXX.XXX.Dispatch.EmailDispatcher (ContractName="XXXX.XXX.Dispatch.IEntityTypeDispatcher") --> XXX.XXX.Dispatch.EmailDispatcher --> AssemblyCatalog (Assembly="XXX.XXX, Version=1.1.2264.871, Culture=neutral, PublicKeyToken=null")
Resulting in: Cannot set import 'XXX.XXXX.Dispatch.DispatcherRepository.Dispatchers (ContractName="XXX.XXX.Dispatch.IEntityTypeDispatcher")' on part 'XXX.XXX.Dispatch.DispatcherRepository'.
Element: XXX.XXX.Dispatch.DispatcherRepository.Dispatchers (ContractName="XXX.XXX.Dispatch.IEntityTypeDispatcher") --> XXX.XXX.Dispatch.DispatcherRepository
(System.ComponentModel.Composition.CompositionException)