Could not load file or assembly 'mscorlib, Version=4.0.0.0' in System.Resources.ResourceManager

281 Views Asked by At

I have a Blazor .NET6.0 project. I have developed a UI plugin system and a translate service (IStringLocalizer does not work inside the plugin).

Everything goes ok in debug mode and standalone release mode. But when I start it in docker-compose in release mode a 'Could not load file or assembly 'mscorlib, Version=4.0.0.0' exception is thrown. The exception is thorwn in this line:

resourceManager = new System.Resources.ResourceManager($"{Assembly}.{Class}.{Language}", _localizationAssembly);

I insist that in debug mode it works ok.

1

There are 1 best solutions below

0
Rossend On

Ok, I finally managed to get it to work with ResourceReader.

ResourceManager works okay inside a Blazor page (OnInitilized), but fails outside it. ResourceReader works fine.