Hi all,
I'm a .NET beginner and I've got a problem on a program where I try to do an
XML serialization.
I get the following error :
"An unmanaged exception of type 'System.IO.FileNotFoundException' occured in
mscorlib.dll
Additonal information : the file or asssembly named n9gu4-bo.dll or one of
its dependencies cannot be found"
Here is the code :
(I've uploaded the complete project at this url
http://netorld.free.fr/Interface2.zip)
public class Form1 : System.Windows.Forms.Form
{
....
....
public Form1()
{
InitializeComponent();
try
{
TextReader reader = new StreamReader("config.xml");
XmlSerializer serializer = new XmlSerializer(typeof(Coef)); //the error
happens at this line
Coef lesCoefs = (Coef)serializer.Deserialize(reader);
reader.Close();
}
catch(XmlException xe)
{
MessageBox.Show (xe.Message, "XML Parse Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch(InvalidOperationException ioe)
{
MessageBox.Show (ioe.InnerException.Message, "XML Serialization Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}//End of class Form1
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://Interface2/Coef
")]
[System.Xml.Serialization.XmlRootAttribute(Namespac e="http://Interface2/Coef
", IsNullable=false)]
public class Coef
{
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute("epreuv e")]
[System.Xml.Serialization.XmlArrayItemAttribute("jo ur",
typeof(CoefEpreuveJourHeure[]), IsNullable=false)]
[System.Xml.Serialization.XmlArrayItemAttribute("he ure",
typeof(CoefEpreuveJourHeure), NestingLevel=1)]
public CoefEpreuveJourHeure[][][] Items;
}
/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://Interface2/Coef
")]
public class CoefEpreuveJourHeure
{
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
public string Value;
}
Le xml file is structured like that :
<?xml version="1.0" encoding="utf-8" ?>
<Coef xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://Interface2/Coef">
<epreuve>
<jour>
<heure>0</heure>
...
</jour>
....
</epreuve>
....
</Coef>
Thanks for your reading and maybe your answer,
Alain