Datei oder Assembly „System.Diagnostics.DiagnosticSource, Version=6.0.0.0 für Azure.AI.FormRecognizer“ konnte nicht gela
Posted: 13 Jan 2025, 14:13
Das Projekt-Framework ist .NET 4.8. Ich habe Azure.AI.FormRecognizer 4.1.0 installiert, was mindestens Azure.Core 1.34.0 erfordert, was System.Diagnostic.DiagnosticSource 6.0.1 erfordert. Aber aus irgendeinem Grund fragt der FormRecognizer nach 6.0.0.0. Übersehe ich etwas Offensichtliches?
Dies ist die Ausgabe:
In der app.config wird es generiert als
Und ich habe versucht, es auf 6.0.1.0 zu ändern, aber das hat nichts gebracht.
So sieht der Fehler aus wie zur Laufzeit:
Dies ist die Ausgabe:
Code: Select all
Exception thrown: 'System.IO.FileNotFoundException' in Azure.AI.FormRecognizer.dll
An exception of type 'System.IO.FileNotFoundException' occurred in Azure.AI.FormRecognizer.dll but was not handled in user code
Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Code: Select all
So sieht der Fehler aus wie zur Laufzeit:
Code: Select all
private Uri _uri;
private AzureKeyCredential _credential;
private DocumentAnalysisClient _analysisClient;
private DocumentModelAdministrationClient _modelClient;
public AzureOcr()
{
_uri = new Uri(_diEndpoint);
_credential = new AzureKeyCredential(_diKey);
_analysisClient = new DocumentAnalysisClient(_uri, _credential); // here it throws "System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.'"
_modelClient = new DocumentModelAdministrationClient(_uri, _credential);
}