2017-09-27 1 views
3

私はVS2017、C#.Net Framework 4.6.2でアプリケーションを開発しています。ファイルまたはアセンブリを読み込めません.Net 4.6.2参照.Net Standard 1.3

私には、GeocodingGoogleナゲットパッケージをインストールしたクラスライブラリがあります。それらはNet Standard 1.3ライブラリです。

System.Xml.XPathと一緒に、他のいくつかのライブラリへの依存関係が追加されました。私は

var geocoder = new GoogleGeocoder("key"); 

var task = geocoder.GeocodeAsync(searchString); 

task.Wait() 

Geocoding.netの方法のいずれかにアクセスしようとすると、

は、しかし、実行時に、私は何をすべきか見当がつかないこのエラー

System.AggregateException occurred 
    HResult=0x80131500 
    Message=One or more errors occurred. 
    Source=mscorlib 
    StackTrace: 
    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) 
    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) 
    at System.Threading.Tasks.Task.Wait() 
    at Easymage.TEC.Entities.Application.QueryHandlers.AddressSearchQueryHandler.Handle(AddressSearchQuery query) in C:\Users\Ludovic\Source\Repos\Easymage.TEC\Easymage.TEC.Entities.Application\QueryHandlers\AddressSearchQueryHandler.cs:line 32 

Inner Exception 1: 
GoogleGeocodingException: There was an error processing the geocoding request. See Status or InnerException for more information. 

Inner Exception 2: 
FileLoadException: Could not load file or assembly 'System.Xml.XPath, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 

Inner Exception 3: 
FileLoadException: Could not load file or assembly 'System.Xml.XPath, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 

を取得します。 System.XML.XPathファイルは、出力フォルダーに存在します。

<dependentAssembly> 
    <assemblyIdentity name="System.Xml.XPath" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> 
    <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> 
    </dependentAssembly> 

<dependentAssembly> 
    <assemblyIdentity name="System.Xml.XPath" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> 
    <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.1.0" /> 
    </dependentAssembly> 

何も動いていないようにみえ、この1:

は、私は、アセンブリバインディングリダイレクトを追加してみました。私はいつもこのエラーを受け取ります。

これは、バインディングリダイレクトとの融合ログです:

=== Pre-bind state information === 
LOG: DisplayName = System.Xml.XPath, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 
(Fully-specified) 
LOG: Appbase = file:///C:/Users/Ludovic/Source/Repos/Easymage.TEC/bin/Server/Debug/ 
LOG: Initial PrivatePath = NULL 
Calling assembly : Geocoding.Google, Version=4.0.0.0, Culture=neutral, PublicKeyToken=48f410544ef36ab4. 
=== 
LOG: This bind starts in default load context. 
LOG: Using application configuration file: C:\Users\Ludovic\Source\Repos\Easymage.TEC\bin\Server\Debug\Easymage.TEC.ServiceHost.exe.Config 
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
LOG: Redirect found in application configuration file: 4.0.1.0 redirected to 4.0.2.0. 
LOG: Post-policy reference: System.Xml.XPath, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 
LOG: The same bind was seen before, and was failed with hr = 0x80131040. 

は、これはバインディングリダイレクトせずに融合ログです:

=== Pre-bind state information === 
LOG: DisplayName = System.Xml.XPath, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 
(Fully-specified) 
LOG: Appbase = file:///C:/Users/Ludovic/Source/Repos/Easymage.TEC/bin/Server/Debug/ 
LOG: Initial PrivatePath = NULL 
Calling assembly : Geocoding.Google, Version=4.0.0.0, Culture=neutral, PublicKeyToken=48f410544ef36ab4. 
=== 
LOG: This bind starts in default load context. 
LOG: Using application configuration file: C:\Users\Ludovic\Source\Repos\Easymage.TEC\bin\Server\Debug\Easymage.TEC.ServiceHost.exe.Config 
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
LOG: Post-policy reference: System.Xml.XPath, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 
LOG: Attempting download of new URL file:///C:/Users/Ludovic/Source/Repos/Easymage.TEC/bin/Server/Debug/System.Xml.XPath.DLL. 
WRN: Comparing the assembly name resulted in the mismatch: Build Number 
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. 
+1

英語版のエラーメッセージを投稿する方がよいでしょう。より多くの牽引力を得るだろう。 – Saleem

+0

@Saleem完了! :) – Ludo

+0

.netフレームワーク4.6.2と.netコア2.0コンソールプロジェクトでテスト済みです。それは正常に働いた。エラーはありません。 – Saleem

答えて

0

これはAsp.Netプロジェクトである場合は、システムをインストールします.Xml.Xpath nugetパッケージをWebプロジェクトに追加します。 Geocodingのlibを私のServiceプロジェクト(私のAPIコントローラからの別のプロジェクト)にインストールしたので、私はこの問題を抱えていました。私はXpath NugetをWebプロジェクトに手動でインストールしなければならず、それを解決しました。

関連する問題