2017-10-18 12 views
4

私のソリューションはコンパイルされますが、実行すると.NET 4.6.1を実行しているクラスライブラリにエラーが発生します。アセンブリのバージョン管理に不一致がありますか? (.Net Core 2.0 with .NET Standard 2クラスライブラリ)

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

お勧めはありますか?

EDIT:

コンプリートエラー:

$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, Func 2 valueFactory) at System.Linq.Enumerable.SelectManySingleSelectorIterator 2.MoveNext() at System.Linq.Enumerable.ConcatIterator 1.MoveNext() at System.Linq.Enumerable.SelectManySingleSelectorIterator 2.MoveNext() at System.Linq.Enumerable.ConcatIterator 1.MoveNext() at System.Linq.Enumerable.<OfTypeIterator>d__32 1.MoveNext() at System.Collections.Generic.List 1.AddEnumerable(IEnumerable 1 enumerable) at System.Linq.Enumerable.ToList[TSource](IEnumerable 1 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.Lazy 1.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

+1

System.Data.Common.DbProviderFactoriesを参照していますか? –

答えて

1

あなたが使用しているアセンブリが参照アセンブリと異なっているときは、エラーのこのタイプを参照してください。

例これらのチェックを行ってください最初のバージョン3を使用して他の2

enter image description here

Version Problem

を使用しているためこのエラーが表示され、この状態で

1:Open references right click on System.Data.Common.DbProviderFactories assembly and check its version

2:Now open you package config or app config file and check the version of that assembly there.

バージョンが競合

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

からライブラリをインストールしてください場合

ソリューション

その後もからの参照からそれを削除「System.Data.Common.DbProviderFactories」 DLLを削除binフォルダに移動あなたのプロジェクトは、あなたがダウンロードした最新のライブラリがこのフォルダに入っているので参照を追加するだけで参照を追加します。 このアセンブリを右クリックしてバージョン名をコピーし、そのバージョンをappconfigまたはpackages設定ファイルに貼り付けます。

+0

返事をありがとう。私は明示的にアセンブリを参照していません。私はSystem.Data.CommonをNugetから取得しようとしましたが、Nugetパッケージのさまざまなバージョンを試してみると役に立ちませんでした。私が何をエラーメッセージにしようとも、それは変わりません。これは、使用されているバージョンではなかったバージョン4.0.0.0を指します。エラーがSystem.Dataであり、System.Data.Commonではない場合は、4.0.0.0が意味をなさないでしょう。 –

+0

あなたはまだ同じ問題に直面していますか? –

+0

はい問題は変わりません。エラーが表示されます: "アセンブリSystem.Dataから"だからおそらく何もSystem.Data.Commonに間違っていた? –

関連する問題