private static InstallPackage Copy(InstallPackage db) { var temp = Path.ChangeExtension(Path.GetTempFileName(), ".msi"); File.Copy(db.FilePath, temp, true); // Open a copy and schedule delete it when closed. var copy = new InstallPackage(temp, DatabaseOpenMode.ReadOnly); copy.DeleteOnClose(temp); return(copy); }