Home > Net >  How ConfigurationManager and App. Config link
How ConfigurationManager and App. Config link

Time:09-22

Everybody is good! I have a doubt, is my new one. The.net Framework class library project, and then add a new App application configuration file. The config, in App. Config add content:
 
<? The XML version="1.0" encoding="utf-8"?>





Then when writing c # code, in the code can obtain such App. The contents of the config:
 
String strConnect=ConfigurationManager. AppSettings [" dbSql "];


I was wondering is ConfigurationManager this object is how to find the App. The config, it both on how relationship? Suppose I add one more application configuration file, it is how to distinguish which find application configuration files? I didn't find it all over engineering properties, both how to associate evidence,

CodePudding user response:

Isn't an Exe file name yao, you can find program compiled good, will find a with corresponding Exe. Exe config file,

CodePudding user response:

reference 1st floor icoolno1 response:
is not Exe file name, you can find good program compiled program, with corresponding Exe. Exe will find a config file,


If it is a class library, generate a *. DLL. Config, it will appear the error: when run is not independently exe inside, must specify exePath, the diagram below:

CodePudding user response:

Reference:

App. Config configuration steps
  • Related