I have two dll's (sqlite) , one dll is a 64 bit and other 32 bit dll. Is it possible to add reference dynamically based on processor architecture? P/Invoke is my last option. Any help would be appreciated!!
Sample Code:
string pathToDll = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\x64\\System.Data.SQLite.dll";
Assembly assembly = Assembly.LoadFrom(pathToDll);
AppDomain.CurrentDomain.Load(assembly.GetName());
Yes, you can load assembly from a file
from .net4 you may use Is64BitOperatingSystem Environment property. Otherwise check IntPtr.Size which changes according to running architecture
Cannot encrypt / decrypt SQLite database in .NET4