2014-01-16 18 views
0

我有奇怪的問題在我的機器上的Silverlight 5項目,Automapper 3.1.0之一,我得到以下錯誤:FileNotFoundException異常:Automapper.Net4在Silverlight 5 Automapper 3.1.0

System.IO。發生FileNotFoundException
Message =無法加載文件或程序集「AutoMapper.Net4,Version = 3.1.0.0,Culture = neutral,PublicKeyToken = be96cd2c38ef1005」或其某個依賴項。
系統找不到指定的文件。

我試過所有的選項,但無法找出爲什麼我在項目中出現這個錯誤。

+0

聽起來就像你引用了automapper的錯誤版本。你想要Silverlight版本。使用NuGet將其添加到您的項目,並刪除引用到.NET4自動映射器 – Charleh

+0

謝謝@Charleh,我只通過Nuget做到了這一點,令人驚訝的是相同的代碼在其他機器上工作正常 – Deepak

回答

1

this issue報價Jimmy Bogard

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.

基本上,這意味着,現在你可以禁用「對所有異常中斷」或按F5鍵,因爲這將不會是一個問題(異常被抓內部)。