Do we need both Automapper and Automapper.Net4 dll

2019-06-18 03:40发布

问题:

Do we need Automapper and Automapper.Net4 dlls together to use the Automaper functionality in our code.

I mean can't we just have the one dll of them both. Using Automapper for the first time.

Need help.

Thanks in advance

回答1:

All you need to do is do "Install-Package AutoMapper" and you're set. Because AutoMapper supports all major .NET platforms, things that are specific to your platform are in a platform-specific assembly. This is a very common approach for building cross-platform libraries.

In short, you shouldn't care, because NuGet takes care of everything for you. It's completely transparent to you as a user. You don't have to do anything extra to take advantage of the platform-specific features.



回答2:

Why not ask Jimmy? AutoMapper using Portable Class Libraries.

From looking at the NuGet package, it would appear Automapper.dll is the core (it's common to all platform libraries), while Automapper.Net4.dll is the platform specific - both are necessary.



回答3:

This is actually the correct answer:

Effectively the .Net4.dll assembly is combined into the one AutoMapper.dll. So you should delete that file. (Jimmy Bogard)

We spent the whole afternoon with a team debugging what is wrong (I got one customer bug report) and could not reproduce. Then finally we found out that the problem is with Automapper.Net4.dll. After deleting it, bug went away (before we already located in the code that the problem is with automapper).