Hi,
I'm having difficulty in getting the linked configuration to work correctly. I have the following element in my app.config file but it fails to show the information from the general configuration in configuration manager when the program has run.
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<linkedConfiguration href="file://c:\MyFolder\MyGenereal.config"/>
</assemblyBinding>
I know that the url is correct as i can ctrl - left click it and VS doesn't show any exceptions when i debug the app using F5.
Any ideas
Thanks in advance
JK

linkedConfiguration information not shown in ConfigurationManager
DLdfrd
Look here for more info.
It says:
"The rules for linkedConfiguration are:
- This feature is only meant for fusion binding policies. Only fusion understands the syntax. The included config files can have settings other than binding policies. But those settings won’t be read by anyone, nor will they have any effect.
- Only file:// HREF linked configurations are allowed. This includes local files, as well as UNC files.
- There is no constraint on the number of linked configurations per config file.
- The semantics is like #include in C/C++. In other words, all the linked configuration files are merged together to form one config file.
- This feature is only allowed in app.config. They are ignored if they are present in publisher policy/machine.config.
- We break the cycle if there is any."
It means that only assembly binding sections are recognized in included configuration file and appSettings are simply ignored.Tryst
Anyone ever got this to work Does it work with appSettings and connectionStrings.
Thanks in advance...
DARKGuy
It really doesn't work :(
I tried this:
main.cs:
public class Tester {
public static void Main() {
Console.WriteLine("appSettings: " + ConfigurationManager.AppSettings.Count);
}
}
main.exe.config:
<configuration>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<linkedConfiguration href="main-add-config.xml"/>
</assemblyBinding>
</configuration>
main-add-config.xml:
<configuration>
<appSettings>
<add key="key" value="some value"/>
</appSettings>
</configuration>
If we compile and run we'll see:
appSettings: 0
If we transfer appSettings from main-add-config.xml into main.exe.config and run again, we'll see:
appSettings: 1
I tried different formats of href attribute: "main-add-config.xml", "file://main-add-config.xml", "file://c:\main-add-config.xml". It doesn't matter.
I have no any idea what's wrong...
barkest