Einige unserer Produkte sind auch mehrsprachig. Einige API-Addins besitzen eine GUI mit WPF, welche die Übersetzungen aus einer Resource-Datei in einer referenzierten Assembly laden.

 

Leider gibt es beim Öffnen des Windows dann folgenden Fehler:

The file or assembly LocalizationExample.Translations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null or a dependency of it was not found.
Assembly loader: LocalizationExample.Translations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null not found
The file or assembly LocalizationExample.Translations, PublicKeyToken=null or a dependency of it was not found.
Assembly loader: LocalizationExample.Translations, PublicKeyToken=null not found
The LocalizationExampleAction action with the /_cmdline:LocalizationExampleAction parameters of the LocalizationExample.EplAddIn.Gui module has failed. Could not load file or assembly 'LocalizationExample.Translations, PublicKeyToken=null' or one of its dependencies. Das System kann die angegebene Datei nicht finden.

 

Ich habe mir mit Fusion++ mal angesehen, was nicht geladen wurde:

LOG: Attempting download of new URL file:///C:/Users/moz/AppData/Roaming/EPLAN/ShadowCopyAssemblies/8980/LocalizationExample.EplAddIn.Gui/bin/en-US/LocalizationExample.EplAddIn.Gui.resources.DLL.
LOG: Attempting download of new URL file:///C:/Users/moz/AppData/Roaming/EPLAN/ShadowCopyAssemblies/8980/LocalizationExample.EplAddIn.Gui/bin/en-US/LocalizationExample.EplAddIn.Gui.resources/LocalizationExample.EplAddIn.Gui.resources.DLL.
LOG: Attempting download of new URL file:///C:/Users/moz/AppData/Roaming/EPLAN/ShadowCopyAssemblies/8980/LocalizationExample.EplAddIn.Gui/bin/en-US/LocalizationExample.EplAddIn.Gui.resources.EXE.
LOG: Attempting download of new URL file:///C:/Users/moz/AppData/Roaming/EPLAN/ShadowCopyAssemblies/8980/LocalizationExample.EplAddIn.Gui/bin/en-US/LocalizationExample.EplAddIn.Gui.resources/LocalizationExample.EplAddIn.Gui.resources.EXE.

 

Der Assembly-Loader sucht nach der falschen Datei… mhh, komisch. Denn der Zugriff außerhalb von WPF, sprich im C# Code, funktioniert ohne Probleme.
Meine Vermutung, dass WPF die Resource-Datei nicht findet hat sich betätigt. Darum greife ich nun BEVOR ich ein WPF-Control erstelle, einmal auf die Assembly zu.

Hab das die Lösung auf GitHub mit einem Beispielprojekt dokumentiert.