Automapper 3.0 - This type is not supported on this platform IMapperRegistry

nano picture nano · Aug 26, 2013 · Viewed 8.1k times · Source

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: This type is not supported on this platform 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.

Answer

jni picture jni · Aug 28, 2013

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.