0

I have strange issue in one of my machine with project on Silverlight 5 with Automapper 3.1.0 where I get following error:

System.IO.FileNotFoundException occurred
Message=Could not load file or assembly 'AutoMapper.Net4, Version=3.1.0.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005' or one of its dependencies.
The system cannot find the file specified.

I have tried all options but not able to find out why I get this error in the project.

John Willemse
  • 6,608
  • 7
  • 31
  • 45
Deepak
  • 107
  • 3
  • 12
  • Sounds like you are referencing the wrong version of automapper. You want the Silverlight version. Use NuGet to add it to your project and remove the ref to the .NET4 automapper – Charleh Jan 16 '14 at 12:28
  • Thanks @Charleh, I did that through Nuget only, surprisingly the same codebase works fine on other machine – Deepak Jan 16 '14 at 12:33

1 Answers1

1

Quoting Jimmy Bogard on this issue:

It just tried to load anything it can find - because I can't detect the runtime, I can't know the exact right assembly, so I just go off a hard-coded, well-known list ( https://github.com/AutoMapper/AutoMapper/blob/f969b94444e6e3c1c71a3582cc6132044b983ed6/src/AutoMapper/Internal/PlatformAdapter.cs#L7). I then just use NuGet's multi-platform capabilities to make sure your project only references the platform-specific assemblies, even though in the package I have all platforms inside.

Basically this means that right now you can either disable "Break on all exceptions" or hit F5, since this won't be a problem (the exception is caught internally).

Joel
  • 7,401
  • 4
  • 52
  • 58