Loading Managed DLL Firebirdsql.DataFirebirdClient.dll is ok
Loading Unmanaged DLL fbembed.dll is not ok for embed
so easy way is not do embed.
DEMO APPLICATION
Sure can run for
=====
http://www.codeproject.com/Articles/528178/Load-DLL-From-Embedded-Resource
1、want packget FirebirdSql.Data.FirebirdClient
tools -> NuGet manager - > manager NuGet
find FirebirdSql.Data.FirebirdClient install to project
2、reference -> FirebirdSql.Data.FirebirdClient.dll
a、copy local -> false
b、get full path [copy]
c、right click on Application1 -> add -> Existing item -> use b. path -> chooses file type dll -> find FirebirdSql.Data.FirebirdClient.dll add
f、click reference -> FirebirdSql.Data.FirebirdClient.dll
Build Action -> Embedded Resource
3、open program.css
a、add using System.Reflection;
b、in main() add
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
c、copy this all
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
Assembly assembly = Assembly.GetExecutingAssembly();
//Project_Namespace.Package_Namespace.dll
//Project Namespace = TestProject
//Package Namesapce = Newtonsoft.Json
using (var stream = assembly.GetManifestResourceStream(“FirebirdSql.Data.FirebirdClient.dll”))
{
byte[] buffer = new byte[stream.Length];
stream.Read(buffer, 0, buffer.Length);
stream.Flush();
stream.Close();
return Assembly.Load(buffer);
}
}
now run application for release, and see WindowsFormsApplication1\bin\Release
have .exe file, try to run.
======reference=====
http://ponyoth.hateblo.jp/entry/2015/07/28/072718