Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4616366
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:58:16+00:00 2026-05-22T01:58:16+00:00

I was playing around with how to use the Configuration Manager to read/write custom

  • 0

I was playing around with how to use the Configuration Manager to read/write custom sections in the App.config file for a WPF application in C#. I read this excellent article on .NET 2.0 Configuration Demystified and it helped me a lot in using the config files. Here is the initial App.config file which I wrote and it works fine.

App.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="example" type="CustomConfig.ExampleSection, CustomConfig" />
  </configSections>
  <example version="A sample string value." />
  <appSettings>
    <add key="version_string" value="1.01" />
  </appSettings>
</configuration>

But when I changed the App.config file in such a way that my custom section will be read from an external config file mentioned in configSource, Visual Studio gives me an error

The format of a configSource file must be an element containing the name
of the section.

Here are the App.config and example.config files

Changed App.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="example" type="CustomConfig.ExampleSection, CustomConfig" />
  </configSections>
  <example configSource="example.config" />
  <appSettings>
    <add key="version_string" value="1.01" />
  </appSettings>
</configuration>

example.config

<?xml version="1.0"?>
<example>
    <add key="version" value="blahblah" />
</example>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:58:17+00:00Added an answer on May 22, 2026 at 1:58 am

    Visual Studio’s editor/intellisense has a shortcoming in that it complains about the configSource= attribute – but it is absolutely legal, and it does work; I use it every day, in various production systems.

    My recommendation: just try it! 🙂 Run the code – I’m pretty sure it will work (your configs look OK to me).

    Update: OK – well it seems you’re totally changing the style of the <example> tag. In your original app.config you have:

    <example version="A sample string value." />
    

    So of course, your externalized example.config must contain the same values and the same structure:

    <?xml version="1.0"?>
    <example version="A sample string value." />
    

    Can you try with this example.config ??

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK, so I'm playing around with an android app. The 90% use case is
I'm playing around, trying to write some code to use the tr.im APIs to
Playing around with Python - tkInter - Entry widget - when I use validatecommand
I've been playing around with LLVM hoping to learn how to use it. However,
I'm playing around with Lucene and noticed that the use of a hyphen (e.g.
While playing around with regexps in Scala I wrote something like this: scala> val
I playing around with the Twitter API for my BlackBerry application. Is there any
After playing around with haskell a bit I stumbled over this function: Prelude Data.Maclaurin>
I am playing around with a little drawing app I am making and was
I been playing around with some custom html helpers and I now I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.