bonjour à tous,
j'ai un soucis j'ai ajouté quelques lignes à un fichier app.config mais quand j'essai de recuperer l'attribut j'ai une erreur:
app.Config:
j'ai rajouté :
1 2 3 4
| <configSections>
<section name="Settings" type="exemple.Settings,exemple"/>
</configSections>
<Settings sourcedir="C:\Users\admin\Documents\Visual Studio 2008\Projects\export\source.xml"/> |
exemple c'est le nom du projet
Settings c'est la classe definie comme ceci:
1 2 3 4 5 6 7 8 9
| class Settings : ConfigurationSection
{
[ConfigurationProperty("sourcedir", IsRequired = true)]
public string nom
{
get { return (string)this["sourcedir"]; }
set { this["sourcedir"] = value; }
}
} |
le pb est le suivant:
Settings set = (Settings)ConfigurationManager.GetSection("Settings");
j'ai une erreur
Echec de l'initialisation du système de récupération
merci
Partager