Today, I installed AutoMapper 3.0.0 (what a great tool, BTW). I ran into the following issue:
My WPF (.NET 4.5) app has several separate projects, and I want to add AutoMapper (via Nuget) to a project that is not the startup project.
This results in the following error being thrown, upon the first interaction with AutoMapper (typically Mapper.Initialize(…) or Mapper.CreateMap<…>):
Could not load file or assembly 'AutoMapper.Net4, Version=220.127.116.11, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
When checking the output dir, the AutoMapper.dll and .xml are both copied to the output dir of the startup project, but not AutoMapper.Net4.dll (and yes – ‘copy local’ is set to true).
A post-build event can fix this issue:
copy "$(TargetDir)AutoMapper.Net4.dll" "$(ProjectDir)..\[your startup project's dir]\$(OutDir)"
Maybe not the ideal way to “fix” this – but it works.