在通过nuget下载EF6并尝试运行我的项目后,它返回以下错误:
没有为ADO找到实体框架提供程序。NET提供程序,使用不变名称'System.Data.SqlClient'。确保提供者在应用程序配置文件的“entityFramework”部分中注册。更多信息请参见http://go.microsoft.com/fwlink/?LinkId=260882。
在通过nuget下载EF6并尝试运行我的项目后,它返回以下错误:
没有为ADO找到实体框架提供程序。NET提供程序,使用不变名称'System.Data.SqlClient'。确保提供者在应用程序配置文件的“entityFramework”部分中注册。更多信息请参见http://go.microsoft.com/fwlink/?LinkId=260882。
当前回答
我有一个控制台应用程序和类库。在类库中,我创建了实体数据模型(右键单击类库>添加>新项目>数据> ADO。NET实体数据模型6.0),并在控制台应用程序中放置引用。因此,你有控制台应用程序,它引用类库,在类库中,你有EF模型。当我试图从表中获取一些记录时,我遇到了同样的错误。
我通过以下步骤解决了这个问题:
Right click to solution and choose option 'Manage NuGet Packages for Solution' and NuGet package manager window will show up. Go to 'Manage' option under 'Installed packages' TIP: Entity Framework is added to Class Library, so you will have EntityFramework under 'Installed packages' and you'll see 'Manage'option Click on 'Manage' option and check to install package to project which has reference to class library which holds EF model (in my case I set check box to install package to console app which had reference to class library which had EF model inside)
这就是我所要做的一切,一切都很完美。
我希望这对你有所帮助。
其他回答
我刚刚遇到了同样的问题,它看起来像EntityFramework,虽然从NuGet包管理器安装没有正确安装在项目中。
我设法通过在包管理器控制台运行以下命令来修复它:
PM> Install-Package EntityFramework
In my case, everything was working properly then suddenly stopped worked because I think Resharper altered some changes which caused the problem. My project was divided into the data layer, service and presentation layer. I had Entity framework installed and referenced in my data layer but still the error didn't go away. Uninstalling and reinstalling didn't work either. Finally, I solved it by making the data layer the Startup project, making migration, updating the database and changing the Startup project back to my presentation layer.
只需安装EntityFramework包到您的Web/控制台项目。这应该会将该节添加到配置文件中。
我刚刚用Nuget重新安装了实体框架。 按照下面链接上的说明操作: http://robsneuron.blogspot.in/2013/11/entity-framework-upgrade-to-6.html
我想问题会解决的。
当错误发生在测试项目时,最漂亮的解决方案是用以下方式装饰测试类:
[DeploymentItem("EntityFramework.SqlServer.dll")]