2016-10-06 19 views
1

は、私は、DLLのリソースC#埋め込みリソースDLL

using (SQLiteConnection c = new SQLiteConnection("Data Source=logindata;Version=3;")) 
    { 
    } 

を必要とする機能を持っていることが必要です。SQLite.Interop.dll

ので、代わりに私が使用するのと同じ的環境のフォルダにそのDLLを置くことを

:それはまだ例外をスロー

[STAThread] 
     static void Main() 
     { 
      Application.EnableVisualStyles(); 
      Application.SetCompatibleTextRenderingDefault(false); 
      AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; 
      Application.Run(new Form1()); 
     } 

     private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) 
     { 
      using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("EmbedAssembly.SQLite.Interop.dll")) 
      { 
       byte[] Data = new byte[stream.Length]; 
       stream.Read(Data, 0, Data.Length); 
       return Assembly.Load(Data); 

      } 
     } 

しかし:それは埋め込みリソースとして

Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 

EDIT:プロジェクトに全く新しいクラスを追加する代わりに、DLLの参照、私のプロジェクトに全く新しいSqliteをクラスを追加することはなく、私のプロジェクトでそれを追加することで解決

答えて

0

としてそれを参照のうえで解決参考として

関連する問題