我是Dapper中的新成員。我試圖通過Dapper創建新項目並映射本地數據庫。不幸的是,我總是收到此錯誤:Dapper錯誤:無法加載類型'Dapper.SqlMapper'
Could not load type 'Dapper.SqlMapper' from assembly 'Dapper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
我加短小精悍的的NuGet(衣冠楚楚v 1.39.0.0)。這是我的代碼示例:
public static IEnumerable<TBMobileDetails> Allmobilelisting()
{
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=""c:\users\database.mdf"";Integrated Security=True");
string query = "select * from Mobiledata";
var result = con.Query<TBMobileDetails>(query);
return result;
}
問題在哪裏?
1.0.0.0非常明顯,因爲1.39.0.0標記爲(不出意外)1.39.0.0;這聽起來像你在你的項目中有一些*其他代碼(可能是間接引用),它預計會有小巧的1.0;你在這裏還有其他的dll嗎? – 2015-04-02 11:05:20
同樣:在你的「bin/{whatever}」構建輸出中 - Dapper dll的文件版本是什麼? – 2015-04-02 11:07:07
謝謝,我從零開始創建項目,現在相同的代碼完美地工作。我不知道發生了什麼事。 – Emil 2015-04-02 11:25:58