title: Error :Could not load file or assembly 'DocumentFormat.OpenXml,
body: <p>I'm getting this error is VS2015</p>
  
  <blockquote>
    <p>Additional information: Could not load file or assembly
    'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral,
    PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
    located assembly's manifest definition does not match the assembly
    reference. (Exception from HRESULT: 0x80131040)</p>
  </blockquote>
  
  <p>I am trying to send mail with database table attachment in c#</p>
  
  <p>here my code id</p>
  
  <pre><code>using ClosedXML.Excel;
  using MySql.Data.MySqlClient;
  using System;
  using System.Data;
  using System.IO;
  using System.Net.Mail;
  using System.Windows.Forms;
  
  namespace Email
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
          String MyConString = "SERVER=10.0.30.125;" + "DATABASE=test;" + "UID=root;" + "PASSWORD=asterisk;" + "Convert Zero Datetime = True";        
          private void button1_Click(object sender, EventArgs e)
          {
              DataTable dt = GetData();
              dt.TableName = "data";
              using (XLWorkbook wb = new XLWorkbook())
              {
                  wb.Worksheets.Add(dt);
                  using (MemoryStream memoryStream = new MemoryStream())
                  {
                      wb.SaveAs(memoryStream);
                      byte[] bytes = memoryStream.ToArray();
                      memoryStream.Close();
                      using (MailMessage Msg = new MailMessage())
                      {
                          Msg.From = new MailAddress("my@mail.com");
                          Msg.To.Add("to@mail.com");
                          Msg.Subject = "DATA";
                          Msg.Body = "Excel Attachment";
                          Msg.Attachments.Add(new Attachment(new MemoryStream(bytes), "DATA.xlsx"));
                          Msg.IsBodyHtml = true;
                          SmtpClient smtp = new SmtpClient();
                          smtp.Host = "smtp.gmail.com";
                          smtp.EnableSsl = true;
                          System.Net.NetworkCredential credentials = new System.Net.NetworkCredential();
                          credentials.UserName = "my@mail.com";
                          credentials.Password = "password";
                          smtp.UseDefaultCredentials = true;
                          smtp.Credentials = credentials;
                          smtp.Port = 587;
                          smtp.Send(Msg);
                          MessageBox.Show("MAIL SENT SUCCESSFULLY TO " + txtTo.Text);
                          txtTo.Text = "";
                      }
                  }
              }
          }
          private DataTable GetData()
          {
              using (MySqlConnection conn = new MySqlConnection(MyConString))
              {
                  using (MySqlCommand cmd = new MySqlCommand("SELECT * from table;", conn))
                  using (MySqlDataAdapter sda = new MySqlDataAdapter())
                  {
                      cmd.Connection = conn;
                      sda.SelectCommand = cmd;
                      using (DataTable dt = new DataTable())
                      {
                          sda.Fill(dt);
                          return dt;
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>I add it in my AddReference</p>
  
  <pre><code>ClosedXml.dll
  DocumentFormat.OpenXml.dll
  MySql.Data.dll
  </code></pre>
  
  <p>Help to solve my problem . why i m getting this error?</p>