所以我的解決方案編譯,但是當我運行它時,我在運行.NET 4.6.1的類庫中出現錯誤。彙編版本不匹配? (.Net Core 2.0與.NET標準2類庫)
System.TypeLoadException: 'Could not load type 'System.Data.Common.DbProviderFactories' from assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
有什麼建議嗎?
編輯:
完全錯誤:
$exception {System.TypeLoadException: Could not load type 'System.Data.Common.DbProviderFactories' from assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. at System.Data.Entity.Infrastructure.DependencyResolution.DefaultProviderFactoryResolver.GetService(Type type, Object key, Func
3 handleFailedLookup) at System.Data.Entity.Infrastructure.DependencyResolution.DefaultProviderFactoryResolver.GetServices(Type type, Object key) at System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func2 valueFactory) at System.Linq.Enumerable.SelectManySingleSelectorIterator
2.MoveNext() at System.Linq.Enumerable.ConcatIterator1.MoveNext() at System.Linq.Enumerable.SelectManySingleSelectorIterator
2.MoveNext() at System.Linq.Enumerable.ConcatIterator1.MoveNext() at System.Linq.Enumerable.<OfTypeIterator>d__32
1.MoveNext() at System.Collections.Generic.List1.AddEnumerable(IEnumerable
1 enumerable) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at System.Data.Entity.Infrastructure.DependencyResolution.InternalConfiguration.Lock() at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.<.ctor>b__1() at System.Lazy
1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy
1.CreateValue() at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.GetConfiguration() at System.Data.Entity.DbContext.InitializeLazyInternalContext(IInternalConnection internalConnection, DbCompiledModel model) at X.Y.ConfigurationModule.ConfigurationContainer..ctor(String nameOrConnectionString)} System.TypeLoadException
您是否引用了System.Data.Common.DbProviderFactories? – 2017-10-18 10:54:50