Inconsistency in assembly versioning? (.Net Core 2.0 with .NET Standard 2 class library)

So, my solution compiles, but when I run it, I get an error in the class library that works with .NET 4.6.1.

System.TypeLoadException: 'Failed to load type' System.Data.Common.DbProviderFactories' from the assembly 'System.Data, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089'.

Any suggestions?

EDIT:

Full error:

$ exception {System.TypeLoadException: Failed to load type 'System.Data.Common.DbProviderFactories' from the assembly 'System.Data, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089'. in System.Data.Entity.Infrastructure.DependencyResolution.DefaultProviderFactoryResolver.GetService (type type, object key, Func 3 handleFailedLookup)     System.Data.Entity.Infrastructure.DependencyResolution.DefaultProviderFactoryResolver.GetServices( , )     System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd (TKey key, Func 2 valueFactory)     System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext () in System.Linq.Enumerable.ConcatIterator 1.MoveNext()     System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext () in System .Linq.Enumerable.ConcatIterator 1.MoveNext()     System.Linq.Enumerable. <OfTypeIterator> d__321.MoveNext () in System.Collections.Generic.List 1.AddEnumerable(IEnumerable1 enumerable) in System.Linq.Enumerable.ToList [TSource] (IEnumerable 1 source)     System.Data.Entity.Infrastructure.DependencyResolution.InternalConfiguration.Lock()     System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager. <.ctor > b__1()     System.Lazy1.ViaFactory (LazyThreadSafetyMode mode) in System.Lazy 1.ExecutionAndPublication(LazyHelper executeAndPublication, Boolean useDefaultConstructor)     System.Lazy 1.CreateValue () in System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.GetConfiguration () in System.Data.Entity.DbContext.InitializeLazyInternalContext (internal connection IInternalConnection, Model DbCompiledModeConfigurationConnectionFunctionCodemeterFunctionCodemeterFunctionCodemeterFunctionCodemeterFunctionCodelonMonfunctionCodemeterFunctionCodelonMonfunctionCodelonMonfunctionCodelonfunctionCodelonMonfunctionCodelonMonfunctionCodelonModelonfunctionCodelonModelonfunctionCodelonMonfunctionCodelonModelonfunctionCodelonModelonfunctionIcon)) } System.TypeLoadException

+4
source share
1 answer

You see this type of error when the assembly you use is different from the reference assembly.

Example

In this condition, you see this error, because the first using version 3 and the others using 2

enter image description here

Version issue

Please complete these checks.

1: Open the link with the right mouse button on the System.Data.Common.DbProviderFactories assembly and check its version

2: .

, ,

https://www.nuget.org/packages/System.Data.Common/

bin, dll 'System.Data.Common.DbProviderFactories', , " ", , , . appconfig .

+1

Source: https://habr.com/ru/post/1687717/


All Articles