Domanda

I have created an application that can switch cultures at runtime. But now I want to add a new Satellite Assembly to my application while the application keeps running. I copy the specific culture folder (e.g. folder af with a Localisation.resources.dll file in it) to the application folder and then I run the following code:

ResourceManager rm = new ResourceManager(ResxExtension.GetDefaultResxName(this), this.GetType().Assembly);

radComboBox1.Items.Clear();
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures).OrderBy(x => x.DisplayName))
{
    ResourceSet resourceSet = rm.GetResourceSet(ci, true, false);
    if (resourceSet != null)
        radComboBox1.Items.Add(ci);
}

// Show CurrentUICulture in the combobox
radComboBox1.SelectedItem = GetResourceCulture(CultureManager.UICulture, rm);

But then nothing happens, I keep seeing the old cultures, but the added culture is not shown. Only when I stop and start the application the new culture is added to the combobox.

Is it possible to add Satellite Assemblies at runtime? Or do I always have to restart the application?

È stato utile?

Soluzione

You have to restart the application. If you don't do that, the Web Application won't register the types found in the bin folder.

Usually, a touch in the web.config triggers the application restart.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top