'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目錄下


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM