3

I have a sample Console application testing the MySQL connectivity. The code is below.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data;
using MySql.Data.MySqlClient;

namespace MySQLConnection
{
    class Program
    {
        static void Main(string[] args)
        {
            string connStr = "server=localhost;user=root;database=world;port=3306;password=Password;";
            using (MySqlConnection conn = new MySqlConnection(connStr))
            {
                conn.Open();

                string sql = "SELECT COUNT(*) FROM Country";
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                object result = cmd.ExecuteScalar();

                if (result != null)
                {
                    int r = Convert.ToInt32(result);
                    Console.WriteLine("Number of countries in the World database is: " + r);
                }
            }
            Console.ReadLine();
        }
    }
}

The code runs fine. But when I try to publish the project I get an error as shown in the image below.

error description

I am using VS2012 Update 3 targeting .NET 4. Any ideas?

Thanks.

UPDATE:

Using this answer: Could not find required file 'setup.bin' I was able to publish the application.

In my case it was that

  1. HKLM\Software\Microsoft\GenericBootstrapper\11.0\Path does not exist.
  2. HKLM\Software\Wow6432Node\Microsoft\GenericBootstrapper\11.0\Path exists and points to C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper\

From that directory I copied the Engine directory to my application directory and then was able to publish the app. Hopefully, this does not need to be done each time.

Community
  • 1
  • 1
sakura-bloom
  • 4,524
  • 7
  • 46
  • 61

1 Answers1

-3

I suggest you to correct your string connection with userid property and add @

var connStr = @"server=localhost;userid=root;database=world;port=3306;password=Password;";
Aghilas Yakoub
  • 28,516
  • 5
  • 46
  • 51