. NET 2.0 configuration file operations (when reading another configuration file)

Source: Internet
Author: User

There was a problem, but I couldn't find it on the Internet.

In vs2005, if the default app. config file is not read, the custom configuration file is read.

You need to use system. configuration. Configuration A = configurationmanager. openexeconfiguration (configuration file path );

Then I get the deletetoken,

String apppath = system. Windows. Forms. application. startuppath;
String configpath = apppath + "\ docaddin. dll. config ";
System. configuration. Configuration Config = system. configuration. configurationmanager. openexeconfiguration (configpath );

String dbpath = config. appsettings. settings ["dbpath"]. value;

The result shows that the settings set of the deleettings is empty. There is no key-value pair at all.

This is defined in my config file.


<? XML version = "1.0" encoding = "UTF-8"?>
<Add key = "dbpath" value = "D: \ Program Files \ default company name \ setupfordocaddin \ docdb. mdb"/>
<Add key = "machineid" value = "defaultmachine"/>

Last found:
  . Appsettings
Configurationmanager. deleettings
Configuration. Different ettings.

The study is continuing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.