2
using System;
using MySql.Data.MySqlClient;
namespace Input
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            string connectionString = "server=SQL09.FREEMYSQL.NET;database=m44m31;uid=m44m31;pwd=*******"; 
            MySqlConnection conn = new MySqlConnection(connectionString);
            try
            {
                conn.Open();
            }
            catch
            {
                Console.WriteLine("Failed to connect");
            }
        }
    }
}

有我的代码,这是我不断收到的错误...我在 ubuntu 上使用单声道:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'MySql.Data, Version=6.5.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies.
File name: 'MySql.Data, Version=6.5.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'MySql.Data, Version=6.5.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies.
File name: 'MySql.Data, Version=6.5.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'

我真的不知道该怎么做,并且到处搜索,请帮助!

    [assembly: AssemblyVersion ("6.5.5.0")]
[assembly: InternalsVisibleTo ("MySql.Data.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d973bda91f71752c78294126974a41a08643168271f65fc0fb3cd45f658da01fbca75ac74067d18e7afbf1467d7a519ce0248b13719717281bb4ddd4ecd71a580dfe0912dfc3690b1d24c7e1975bf7eed90e4ab14e10501eedf763bff8ac204f955c9c15c2cf4ebf6563d8320b6ea8d1ea3807623141f4b81ae30a6c886b3ee1")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyKeyName ("ConnectorNet")]
[assembly: InternalsVisibleTo ("MySql.Data.CF.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d973bda91f71752c78294126974a41a08643168271f65fc0fb3cd45f658da01fbca75ac74067d18e7afbf1467d7a519ce0248b13719717281bb4ddd4ecd71a580dfe0912dfc3690b1d24c7e1975bf7eed90e4ab14e10501eedf763bff8ac204f955c9c15c2cf4ebf6563d8320b6ea8d1ea3807623141f4b81ae30a6c886b3ee1")]
[assembly: InternalsVisibleTo ("MySql.Data.Entity, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d973bda91f71752c78294126974a41a08643168271f65fc0fb3cd45f658da01fbca75ac74067d18e7afbf1467d7a519ce0248b13719717281bb4ddd4ecd71a580dfe0912dfc3690b1d24c7e1975bf7eed90e4ab14e10501eedf763bff8ac204f955c9c15c2cf4ebf6563d8320b6ea8d1ea3807623141f4b81ae30a6c886b3ee1")]
[assembly: Debuggable (DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: CompilationRelaxations (8)]
[assembly: RuntimeCompatibility (WrapNonExceptionThrows = true)]
[assembly: TargetFramework (".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
[assembly: AssemblyDescription ("ADO.Net driver for MySQL")]
[assembly: AssemblyCompany ("Oracle")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("Copyright © 2004, 2010, Oracle and/or its affiliates. All rights reserved.")]
[assembly: AssemblyTrademark ("")]
[assembly: ComVisible (false)]
[assembly: CLSCompliant (false)]
[assembly: AssemblyTitle ("MySql.Data.dll")]
[assembly: AllowPartiallyTrustedCallers ]
[assembly: SecurityRules (SecurityRuleSet.Level1)]
[assembly: AssemblyDelaySign (false)]

它被添加到程序集中^^^^

4

1 回答 1

2

看来您对 MySql.Data dll 的引用已损坏。验证 .csproj 文件是否包含对正确 dll 的引用以及该 dll 是否存在于正确的位置。如果这不能解决您的问题,请发布更多信息!

于 2012-12-09T18:39:11.843 回答