App.config creates and reads problem sections

I am trying to work with app.config sections in this example:

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

and this gives me the following 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 configuration 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 don’t understand why .... can anyone help? thanks.

+4
source share
1 answer

In your app.config application, make sure you have the full namespace for the ConfigurationCollectionAttribute class

For instance:

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

All Articles