实体框架提供程序类型无法加载? [英] Entity Framework Provider type could not be loaded?
问题描述
我试图运行这是目前我的机器上安装我的TeamCity的测试。
System.InvalidOperationException信息:System.InvalidOperationException
:
实体框架提供程序类型 System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer
, =版本6.0.0.0,文化=中性公钥= b77a5c561934e089'
为 System.Data.SqlClient的
'ADO.NET提供程序无法加载。
确保供应商组装可用于运行的应用程序。
请参阅http://go.microsoft.com/fwlink/?LinkId=260882了解更多信息。
我在我的任何项目中没有提及 System.Data.Entity的
作为于codePLEX建议升级到EF6。
所以,我不知道为什么我会收到此异常。
当我运行VS测试我没有得到任何这样的例外。
我曾尝试CopyLocal然后再设置为false为true ..但似乎并没有任何工作。
更新
我的app.config有以下。这是否会导致一些行为我不明白?
<?XML版本=1.0编码=UTF-8&GT?;
<结构>
< configSections>
<节名称=的EntityFrameworkTYPE =System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,的EntityFramework,版本6.0.0.0 =文化=中性公钥= b77a5c561934e089requirePermission =FALSE/>
<! - 有关Entity Framework的配置的详细信息,请访问http://go.microsoft.com/fwlink/?LinkID=237468 - >
< / configSections>
<&的EntityFramework GT;
< defaultConnectionFactory TYPE =System.Data.Entity.Infrastructure.SqlConnectionFactory,的EntityFramework/>
< /&的EntityFramework GT;
< /结构>
我得到的TeamCity以下堆栈跟踪。
[MSTest的] IntegrationTests.CrudTest + QuestionTest.Create
[3点59分11秒] [IntegrationTests.CrudTest + QuestionTest.Create]初始化方法IntegrationTests.CrudTest + QuestionTest.Initialize抛出异常。 System.InvalidOperationException信息:System.InvalidOperationException:实体框架提供商类型'System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer,版本6.0.0.0 =文化=中性公钥= b77a5c561934e089'为'System.Data.SqlClient的ADO.NET提供程序无法加载。确保供应商组装可用于运行的应用程序。请参阅http://go.microsoft.com/fwlink/?LinkId=260882以获取更多信息..
[3点59分11秒]
[IntegrationTests.CrudTest + QuestionTest.Create]在System.Data.Entity.Config.ProviderServicesFactory.GetInstance(字符串providerTypeName,字符串providerInvariantName)
在System.Data.Entity.Config.ProviderServicesFactory.GetInstanceByConvention(字符串providerInvariantName)
在System.Data.Entity.Config.DefaultProviderServicesResolver.GetService(类型类型,对象键)
在System.Data.Entity.Config.CachingDependencyResolver.<>c__DisplayClass1.<GetService>b__0(Tuple`2 K)
在System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKEY的关键,Func`2 valueFactory)
在System.Data.Entity.Config.CachingDependencyResolver.GetService(类型类型,对象键)
在System.Data.Entity.Config.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver R)
在System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
在System.Linq.Enumerable.FirstOrDefault [TSource](IEnumerable`1源,Func`2 predicate)
在System.Data.Entity.Config.ResolverChain.GetService(类型类型,对象键)
在System.Data.Entity.Config.RootDependencyResolver.GetService(类型类型,对象键)
在System.Data.Entity.Config.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver R)
在System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
在System.Linq.Enumerable.FirstOrDefault [TSource](IEnumerable`1源,Func`2 predicate)
在System.Data.Entity.Config.ResolverChain.GetService(类型类型,对象键)
在System.Data.Entity.Config.CompositeResolver`2.GetService(类型类型,对象键)
在System.Data.Entity.Config.IDbDependencyResolverExtensions.GetService [T](IDbDependencyResolver解析器,对象键)
在System.Data.Entity.Config.InternalConfiguration.GetService [TService(对象键)
在System.Data.Entity.Config.DbConfiguration.GetService [TService(对象键)
在System.Data.Entity.Utilities.DbProviderFactoryExtensions.GetProviderServices(DbProviderFactory厂)
在System.Data.Entity.Infrastructure.DefaultManifestTokenService.GetProviderManifestToken(连接的DbConnection)
在System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(连接的DbConnection,DbProviderManifest&安培; providerManifest)
在System.Data.Entity.DbModelBuilder.Build(的DbConnection providerConnection)
在System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
在System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput输入)
在System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
在System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(类型的EntityType)
在System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
在System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
在System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(动作动作,EntityState newState,对象实体,字符串方法名)
在System.Data.Entity.Internal.Linq.InternalSet`1.Add(对象实体)
在System.Data.Entity.DbSet`1.Add(TEntity实体)
在EFRepository.Infrastructure.EFRepository`1.Add(T项目)在C:\\ TeamCity的\\ buildAgent \\工作\\ da2ea4e72c0e77f0 \\库\\基础设施\\ EFRepository.cs:行22
在IntegrationTests.CrudTest.Initialize()在C:\\ TeamCity的\\ buildAgent \\工作\\ da2ea4e72c0e77f0 \\ IntegrationTests \\ CrudTest.cs:行34
同样的问题,但我通过安装的NuGet EF 6。 EntityFramework.SqlServer失踪了另一个可执行文件。我只是添加了的NuGet包到该项目。
I am trying to run my tests on TeamCity which is currently installed on my machine.
System.InvalidOperationException: System.InvalidOperationException
:
The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer
, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
for the 'System.Data.SqlClient
' ADO.NET provider could not be loaded.
Make sure the provider assembly is available to the running application.
See http://go.microsoft.com/fwlink/?LinkId=260882 for more information..
I have no reference to System.Data.Entity
in any of my projects as was suggested on codeplex for upgrading to EF6.
So, I am not sure why am I getting this exception. I do not get any such exception when I run the tests from VS.
I did try to set CopyLocal to false then again to true.. but that does not seem to work either.
Update
My app.config has the following . Does this cause some behavior that I don't understand ?
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
</configuration>
I get the following stacktrace in teamcity .
[MSTest] IntegrationTests.CrudTest+QuestionTest.Create
[03:59:11][IntegrationTests.CrudTest+QuestionTest.Create] Initialization method IntegrationTests.CrudTest+QuestionTest.Initialize threw exception. System.InvalidOperationException: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' for the 'System.Data.SqlClient' ADO.NET provider could not be loaded. Make sure the provider assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information..
[03:59:11]
[IntegrationTests.CrudTest+QuestionTest.Create] at System.Data.Entity.Config.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName)
at System.Data.Entity.Config.ProviderServicesFactory.GetInstanceByConvention(String providerInvariantName)
at System.Data.Entity.Config.DefaultProviderServicesResolver.GetService(Type type, Object key)
at System.Data.Entity.Config.CachingDependencyResolver.<>c__DisplayClass1.<GetService>b__0(Tuple`2 k)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at System.Data.Entity.Config.CachingDependencyResolver.GetService(Type type, Object key)
at System.Data.Entity.Config.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at System.Data.Entity.Config.ResolverChain.GetService(Type type, Object key)
at System.Data.Entity.Config.RootDependencyResolver.GetService(Type type, Object key)
at System.Data.Entity.Config.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at System.Data.Entity.Config.ResolverChain.GetService(Type type, Object key)
at System.Data.Entity.Config.CompositeResolver`2.GetService(Type type, Object key)
at System.Data.Entity.Config.IDbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver, Object key)
at System.Data.Entity.Config.InternalConfiguration.GetService[TService](Object key)
at System.Data.Entity.Config.DbConfiguration.GetService[TService](Object key)
at System.Data.Entity.Utilities.DbProviderFactoryExtensions.GetProviderServices(DbProviderFactory factory)
at System.Data.Entity.Infrastructure.DefaultManifestTokenService.GetProviderManifestToken(DbConnection connection)
at System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
at System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName)
at System.Data.Entity.Internal.Linq.InternalSet`1.Add(Object entity)
at System.Data.Entity.DbSet`1.Add(TEntity entity)
at EFRepository.Infrastructure.EFRepository`1.Add(T item) in c:\TeamCity\buildAgent\work\da2ea4e72c0e77f0\Repository\Infrastructure\EFRepository.cs:line 22
at IntegrationTests.CrudTest.Initialize() in c:\TeamCity\buildAgent\work\da2ea4e72c0e77f0\IntegrationTests\CrudTest.cs:line 34
Same problem, but i installed EF 6 through Nuget. EntityFramework.SqlServer was missing for another executable. I simply added the nuget package to that project.
这篇关于实体框架提供程序类型无法加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!