Automapper 3.0-该平台不支持此类型IMapperRegistry [英] Automapper 3.0 - This type is not supported on this platform IMapperRegistry
问题描述
我将项目更新为使用 Automapper 3.0.0 ,现在我的TFS构建失败.错误如下:
I updated my project to use Automapper 3.0.0 and now my TFS build is not succeeding. The error is the following:
" ... System.PlatformNotSupportedException:System.PlatformNotSupportedException:该平台IMapperRegistry不支持此类型."
有没有人可以帮助我解决此问题. 同时,我将恢复到以前的版本,因为该版本似乎工作正常.
Is there anyone that can help me resolve this issue. In the mean time, I am going to revert to previous version since that one seems to work fine.
推荐答案
我们在构建服务器上遇到了同样的问题. MsTest似乎删除了它认为不必要的DLL(请注意:此声明仅是有根据的猜测).若要修复此问题,请对AutoMapper.Net4.dll中的内容添加显式调用.例如,对于类ListSourceMapper:
We had the same issue on our build server. MsTest seemed to remove DLLs it deemed unnecessary (note : this claim is only an educated guess). To fix it, add an explicit call to something in AutoMapper.Net4.dll. For instance, with the class ListSourceMapper :
var useless = new ListSourceMapper()
将此项目添加到其他所有项目共享的项目中,为我们修复了该问题.这行代码的放置位置可能会有所不同.
Adding this to a project which is shared by all other projects fixed it for us. Where to put this line of code may vary.
这篇关于Automapper 3.0-该平台不支持此类型IMapperRegistry的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!