0

I have two c# solutions. Solution A and Solution B. There is an appsettings key in in solution A, ie, <add key="SystemRequirementsUrl" value="Documents/Systems Requirement-January2016.pdf"/>

How can i access this value in solution B, so that in the xaml file, i can give like the following.

<HyperlinkButton x:Name="click_hyperlink"
                        NavigateUri = (KEY VALUE SHOULD COME HERE)
                         TargetName="_blank" />
Nandu PH
  • 145
  • 1
  • 4
  • 10
  • 1
    i dont think your solution A can access solution B AppSetting config file.Somehow you can do this using DB setting table. – Amit Soni Feb 02 '16 at 06:26

2 Answers2

0

I think this should work:

ConfigurationFileMap fileMap = new ConfigurationFileMap(file); //Path to your config file
Configuration configuration = ConfigurationManager.OpenMappedMachineConfiguration(fileMap);
string value = configuration.AppSettings.Settings["key1"].Value;

Found it here.

Community
  • 1
  • 1
diiN__________
  • 7,393
  • 6
  • 42
  • 69
0

A solution is always independent of other solution. During development you may have two solutions on same machine. However This is not guaranteed in production environment.

Besides two solution trying to access same physical resource might bring up conflict.

You should create separate app settings for each solution and keep them synced.

Or keep the configuration in a table and access it from there in each solution.

ItsZeus
  • 142
  • 12