'System.Data.SqlClient' could not be loaded解決辦法

現象:

The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application.

引用: 高人dudu 的回覆

這是一個誤導人的錯誤信息,實際是因爲找不到 EntityFramework.SqlServer.dll 文件。

問題背景是web項目所引用的項目中安裝了EF的nuget包,而web項目本身沒有安裝。於是build後,web項目的bin文件夾中只有EntityFramework.dll,卻沒有EntityFramework.SqlServer.dll。

解決方法:web項目也安裝Entity Framework的nuget包。

把所引用的項目中安裝了EF的nuget包的bin目錄下的EntityFramework.SqlServer.dll 文件複製到Web項目中的bin目錄下

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章