Sqlite 基于平台安装不同版本的程序集?
我正在VS2008中为一个使用SQLite的C#应用程序创建一个安装程序,该应用程序需要用于x86和x64环境的不同版本的程序集。让安装程序根据环境自动安装正确程序集的最佳方法是什么?最终,我不得不对此进行一些修改。安装项目现在包括一个包含x86和x64版本SQLite的zip文件。My project installer类钩子覆盖OnBeforeInstall方法,然后将zip文件解压缩到临时文件夹,检查环境,并将正确的版本复制到应用程序安装文件夹 虽然为了保持代码的相关性,已经从这个示例中删除了日志记录和错误处理,但是代码就是这样的Sqlite 基于平台安装不同版本的程序集?,sqlite,installation,x86,64-bit,Sqlite,Installation,X86,64 Bit,我正在VS2008中为一个使用SQLite的C#应用程序创建一个安装程序,该应用程序需要用于x86和x64环境的不同版本的程序集。让安装程序根据环境自动安装正确程序集的最佳方法是什么?最终,我不得不对此进行一些修改。安装项目现在包括一个包含x86和x64版本SQLite的zip文件。My project installer类钩子覆盖OnBeforeInstall方法,然后将zip文件解压缩到临时文件夹,检查环境,并将正确的版本复制到应用程序安装文件夹 虽然为了保持代码的相关性,已经从这个示例中删
protected override void OnBeforeInstall(IDictionary savedState)
{
base.OnBeforeInstall(savedState);
UnzipSQLite();
}
private void UnzipSQLite()
{
// Installation directory
string targetDir = Context.Parameters["TargetDir"];
// SQLite.zip is saved in the temp folder by the installer
// This is setup via the GUI in Visual Studio
string zipFile = Path.Combine(TempFolder, "SQLite.zip");
// Folder where it will be unzipped to
string tempDir = Path.Combine(TempFolder, Guid.NewGuid().ToString());
// Unzip it. Requires SharpZipLib
FastZip fz = new FastZip();
fz.ExtractZip(zipFile, tempDir, FastZip.Overwrite.Always, null, string.Empty, string.Empty, true);
// Check if OS is x86 or x64
// http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/24792cdc-2d8e-454b-9c68-31a19892ca53
string subDir = (OSChecker.Is64BitOperatingSystem) ? "x64" : "x86";
// Source and destination paths
string src = Path.Combine(tempDir, subDir + "\\System.Data.SQLite.DLL");
string dest = Path.Combine(targetDir, "System.Data.SQLite.DLL");
// Move the SQLite DLL
File.Move(src, dest);
// All done. Delete our temp folder.
Directory.Delete(tempDir, true);
}