Hello everybody,
I put this in a separate thread because altough it is connected to the localization-problem in my former thread this is a completely
different "joke" of the IDE.
While waiting for some hint on how to include my own ressources in IDE-generated satellite-assemblies (because there can only be on
assembly per each language) I decided to try to use the XML-editor for the IDE-generated .resx-files again.
I noticed that the IDE starts with the .resx-file for the language which is currently set as the form's property. As soon as you
change the language property of the form the IDE will inadvertedly rewrite the current .resx-file (removing all entries made by
myself) and open the one of the language you have switched to. Thus, for the moment, I provided all elements with neutral and
localized language texts in the designer and afterwards added my own strings with the XML-editor to the neutral .resx-file and to
the localized .resx-files. As long as I do not switch language properties of the form again these files will remain untouched.
I rebuilt the project and noticed, that the MyApp.exe in the obj\Debug-directory will correctly load MyApp.resources.dll, but not so
the MyApp.exe in the bin\Debug-directory (checked it with FusLogVW).
The difference lies in the MyApp.exe.config-files:
Earlier I had tried to add some dynamic properties to some elements in the form. Although I had removed these later on the
config-file in bin-directory still contained the entries in the <appsettings>-section.
The config-file in obj-directory only contained
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
</assemblyBinding>
</runtime>
which can not be found in the other config-file.
Some things are striking here:
- The <assemblyBinding> - element gives no information (redirection or the like), yet it is obviously necessary for the application
to load the satellite-assemblies.
- It is the only element in the obj-config-file but omitted in the bin-config-file. On the other hand the <appsettings>-section does
not appear in the obj-config-file.
- Adding the <runtime>-section to the bin-config-file will not work, still the assemblies are NOT loaded. Only completely removing
the <appsettings>-section and putting in the <runtime>-section (which essentially means copying the obj-config-file to the
bin-directory) will lead to success.
- Upon building the project the IDE recovers the bin-config-file (only <appsettings>-section again), although I already removed the
dynamic properties earlier. I wonder from where the IDE has got this information.
The IDE might be helpful, but this goes a little bit far. Can someone explain me if I am doing something wrong?
How can I prevent the IDE from overwriting my changes to the config-file in bin\Debug?
How can I include BOTH <assemblyBinding> and <appsettings> information so that assembly-loading still works?
Why is there a difference between config-files in bin- and obj-directories?
Best regards
Rolf