'System.IO.FileNotFoundException' Exception raised when i try to run MysqlBackup.net

Jul 22, 2015 at 12:27 PM
hi. i started to work on a project using teh lastest Mysql Connector .Net(6.9.0.6). I referenced the MysqlBackup.net's DLL in my project. i added the using instruction for MySql.Data.MySqlClient and my classe is like this.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
using System.IO;
using System.Windows.Forms;

namespace K_PERSONNES
{
    class DbBackup
    {
       UserConfig MyUsrConf;
        string path { get; set; }
        DirectoryInfo BackupFolder;

        public DbBackup()
        {
            path = "";
            MyUsrConf = new UserConfig();
            
        }


        public void Start()
        {
            string filename = "";
            path = MyUsrConf.GetActualBackupFolder();

            if (!string.IsNullOrEmpty(path))
            {
                BackupFolder = new DirectoryInfo(path);

                if (!BackupFolder.Exists)
                    BackupFolder.Create();

                filename = path + @"\" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year;

                using (MySqlConnection ConnectionObject = new MySqlConnection(Properties.Settings.Default.Odeon.ToString()))
                {
                    using (MySqlCommand CommandObject= new MySqlCommand ())
                    {

                        using (MySqlBackup BackupObject = new MySqlBackup ())
                        {
                            CommandObject.Connection = ConnectionObject;
                            BackupObject.Command = CommandObject;
                            BackupObject.ExportInfo.EnableEncryption = true;
                            BackupObject.ExportInfo.EncryptionPassword = "ktechnologie";
                            try
                            {
                                ConnectionObject.Open();
                                BackupObject.ExportToFile(filename);
                                ConnectionObject.Close();
                            }
                            catch (Exception ex)
                            {
                                MessageBox .Show (ex.Message ,"Message",MessageBoxButtons.OK,MessageBoxIcon.Error );
                            }
                        }
                    }
                }

            }
            else
            {
                MessageBox.Show("La sauvegarde n'a pas pu s'effectuer, veuillez Définir un repertoire de sauvegarde et recommancer ","Message",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }

            
    }
}

but i get this exception when i run the start method
Une exception non gérée du type 'System.IO.FileNotFoundException' s'est produite dans K_PERSONNES.exe
Informations supplémentaires : Impossible de charger le fichier ou l'assembly 'MySql.Data, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' ou une de ses dépendances. Le fichier spécifié est introuvable.

Nedd your help please. Thank
Coordinator
Jul 23, 2015 at 12:28 AM
path = MyUsrConf.GetActualBackupFolder();
BackupFolder = new DirectoryInfo(path);
filename = path + @"\" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year;
BackupFolder is not used in building up the filename.
Is there anything to do with BackupFolder with filename?
Coordinator
Jul 23, 2015 at 12:31 AM
Try use this code and try again:
public void Start()
        {
            string filename = "D:\\backup.sql";

                using (MySqlConnection ConnectionObject = new MySqlConnection(Properties.Settings.Default.Odeon.ToString()))
                {
                    using (MySqlCommand CommandObject= new MySqlCommand ())
                    {

                        using (MySqlBackup BackupObject = new MySqlBackup ())
                        {
                            CommandObject.Connection = ConnectionObject;
                            BackupObject.Command = CommandObject;
                            BackupObject.ExportInfo.EnableEncryption = true;
                            BackupObject.ExportInfo.EncryptionPassword = "ktechnologie";
                            try
                            {
                                ConnectionObject.Open();
                                BackupObject.ExportToFile(filename);
                                ConnectionObject.Close();
                            }
                            catch (Exception ex)
                            {
                                MessageBox .Show (ex.Message ,"Message",MessageBoxButtons.OK,MessageBoxIcon.Error );
                            }
                        }
                    }
                }

            }
            else
            {
                MessageBox.Show("La sauvegarde n'a pas pu s'effectuer, veuillez Définir un repertoire de sauvegarde et recommancer ","Message",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }

            
    }
}