Application Blocks (XML File) Configuration Manager

L

Lee Connell

Hello,

I am trying to use the Application blocks configuration manager. I am
reading the docs on how to setup the app.config file to use the proper
reader/writer. I want to use xml file. I followed the directions and I am
still getting an error in the app.config file, it's complaining about
"Unrecognized configuration section", "applicationConfigurationManagement".

Here is the app.config file declaration as the docs say:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<applicationConfigurationManagement defaultSection="TestConfigSection">
<configSection name="TestConfigSection">

<configProvider
assembly="Microsoft.ApplicationBlocks.ConfigurationManagement.Storage.XmlFil
eStorage" path="C:\\Documents and Settings\\Lee Connell\\My
Documents\\Visual Studio Projects\\ConfigTest\\ConfigTest.xml"
refreshOnChange="true" signed="false" encrypted="false"/>

</configSection>
</applicationConfigurationManagement>
</configuration>

What am I missing to use this correctly?

Thank you
 
L

Lee Connell

I have tried the following also. I am pretty aggrivated right now because I
don't believe it is clear enough on how to set this. It could also be my
lack of xml xsd knowledge.

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<configSections>

<section name="applicationConfigurationManagement"
type="System.Configuration.NameValueSectionHandler,System.Configuration,Vers
ion=1.0.0.0,Culture=neutral,PublicKeyToken=null"/>

</configSections>


<applicationConfigurationManagement defaultSection="TestConfigSection">

<configSection name="TestConfigSection">

<configProvider
assembly="Microsoft.ApplicationBlocks.ConfigurationManagement.Storage.XmlFil
eStorage" path="C:\\Documents and Settings\\Lee Connell\\My
Documents\\Visual Studio Projects\\ConfigTest\\ConfigTest.xml"
refreshOnChange="true" signed="false" encrypted="false"/>

</configSection>

</applicationConfigurationManagement>

</configuration>
 
A

Allen Jones

Sorry Lee,

I cant see the rest of the thread, so I dont have a clue what problem you
are seeing. But from the look of the XML config file you have shown, your
<configProvider> element is missing a "type" attribute, which tells CMAB the
name of the provider class.

Try:

type="Microsoft.ApplicationBlocks.ConfigurationManagement.Storage.XmlFileSto
rage"

Also not sure if you need the "\\" in your path attribute or just "\" - cant
remember.

Regards
Allen
 
L

Lee Connell

Hi Allen,

I sent you an email also, I don't know what you can't see?

Here is the config file I've been trying to get to work.

This is the "App.Config" file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<configSections>

<section

name="applicationConfigurationManagement"

type="Microsoft.ApplicationBlocks.ConfigurationManagement.ConfigurationManag
erSectionHandler,Microsoft.ApplicationBlocks.ConfigurationManagement,
Version=1.0.0.0,Culture=neutral,PublicKeyToken=null"/>

</configSections>


<applicationConfigurationManagement defaultSection="TestConfigSection">

<configSection name="TestConfigSection">

<configProvider

assembly="Microsoft.ApplicationBlocks.ConfigurationManagement,Version=1.0.0.
0,Culture=neutral,PublicKeyToken=null"

type="Microsoft.ApplicationBlocks.ConfigurationManagement.Storage.XmlFileSto
rage"

path="C:\\Documents and Settings\\Lee Connell\\My Documents\\Visual Studio
Projects\\ConfigTest\\ConfigTest.xml"

refreshOnChange="true"

signed="false"

encrypted="false"/>

</configSection>

</applicationConfigurationManagement>

</configuration>

Here is the "ConfigTest.xml" file I want to use to read and write values to:

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<TestConfigSection>

</TestConfigSection>

</configuration>
 
A

Allen Jones

Lee,

Add a <section> element for the TestConfigSection to the <configSections>
element of your application's config file, so it should look like this.


<configSections>

<section name="applicationConfigurationManagement"
type="System.Configuration.NameValueSectionHandler,System.Configuration,Vers
ion=1.0.0.0,Culture=neutral,PublicKeyToken=null"/>

<section name="TestConfigSection"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.XmlHashtableSectio
nHandler,Microsoft.ApplicationBlocks.ConfigurationManagement,
Version=1.0.0.0,Culture=neutral,PublicKeyToken=null" />

</configSections>

Regards
Allen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top