N.D
N.D

Reputation: 1049

app.config creating and reading sections trouble

I have been trying to work with app.config sections by this example:

http://msdn.microsoft.com/en-us/library/system.configuration.configurationcollectionattribute.aspx#Y2391

and its giving me the next exception:

An error occurred creating the configuration section handler for MyUrls: Could not load file or assembly 'ConfigurationCollectionAttribute, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. (E:\Projects\AppConfigSectionsTesting\AppConfigSectionsTesting\bin\Debug\AppConfigSectionsTesting.vshost.exe.Config line 4)

this is the config file -

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

 <configSections>
   <section name="MyFolders" type="FoldersSection, 
      ConfigurationCollectionAttribute, Version=1.0.0.0, Culture=neutral,   PublicKeyToken=null" />
</configSections>
<MyFolders>
   <Folders>
    <add Path ="D:\\RUN"/>
</Folders>
</MyFolders>

 </configuration>

i dont understand why.... can anyone help? thank you.

Upvotes: 4

Views: 1323

Answers (1)

Andrew
Andrew

Reputation: 13221

In your app.config, check that you've got the full namespace to the class ConfigurationCollectionAttribute

For example:

<configSections>
    <section name="configSectionName"
             type="Company.Namespace.ConfigSection, Company.Namespace" />
</configSections>

Upvotes: 3

Related Questions