Help. Installer/Database Error
Hi, I have a little program that edits an msi and generates a transform based on the changes
it all works except when I go to Delete the Temporary MSI - error is the file is in use by another process...I can't seem to work it out...any help would be greatly appreciated...
heres the relevant code
the line that errors is "My.Computer.FileSystem.DeleteFile(tmpName)"
I think it's to do with the objCopyDatabase object locking the file, but I have no clue how to release it...
objInstaller = CreateObject("WindowsInstaller.Installer")
objCopyDatabase = objInstaller.OpenDatabase(tmpName, 1)
objOrigDatabase = objInstaller.OpenDatabase(strBaseFileName, 0)
View = objCopyDatabase.OpenView("INSERT INTO `Property` (`Property`,`Value`) VALUES ('LICENSELOCATION', '" & frmMain.txtDir.Text & "')")
View.Execute() : View.Close() : objCopyDatabase.Commit()
View = objCopyDatabase.OpenView("INSERT INTO `Property` (`Property`,`Value`) VALUES ('LICENSEDTO', '" & frmMain.txtLic.Text & "')")
View.Execute() : View.Close() : objCopyDatabase.Commit()
View = objCopyDatabase.OpenView("INSERT INTO `Property` (`Property`,`Value`) VALUES ('SERVERID', '" & frmMain.txtServer.Text & "')")
View.Execute() : View.Close() : objCopyDatabase.Commit()
View = objCopyDatabase.OpenView("INSERT INTO `Property` (`Property`,`Value`) VALUES ('USERHOME', '" & frmMain.txtUser.Text & "')")
View.Execute() : View.Close() : objCopyDatabase.Commit()
View = Nothing
objCopyDatabase.GenerateTransform(objOrigDatabase, strWorkingDir & strBaseMSTName & ".mst")
objCopyDatabase.CreateTransformSummaryInfo(objOrigDatabase, strWorkingDir & strBaseMSTName & ".mst", 0, 0)
objCopyDatabase.Commit()
objCopyDatabase = Nothing
objOrigDatabase = Nothing
objInstaller = Nothing
My.Computer.FileSystem.DeleteFile(tmpName)
Cheers
DiTcH
it all works except when I go to Delete the Temporary MSI - error is the file is in use by another process...I can't seem to work it out...any help would be greatly appreciated...
heres the relevant code
the line that errors is "My.Computer.FileSystem.DeleteFile(tmpName)"
I think it's to do with the objCopyDatabase object locking the file, but I have no clue how to release it...
objInstaller = CreateObject("WindowsInstaller.Installer")
objCopyDatabase = objInstaller.OpenDatabase(tmpName, 1)
objOrigDatabase = objInstaller.OpenDatabase(strBaseFileName, 0)
View = objCopyDatabase.OpenView("INSERT INTO `Property` (`Property`,`Value`) VALUES ('LICENSELOCATION', '" & frmMain.txtDir.Text & "')")
View.Execute() : View.Close() : objCopyDatabase.Commit()
View = objCopyDatabase.OpenView("INSERT INTO `Property` (`Property`,`Value`) VALUES ('LICENSEDTO', '" & frmMain.txtLic.Text & "')")
View.Execute() : View.Close() : objCopyDatabase.Commit()
View = objCopyDatabase.OpenView("INSERT INTO `Property` (`Property`,`Value`) VALUES ('SERVERID', '" & frmMain.txtServer.Text & "')")
View.Execute() : View.Close() : objCopyDatabase.Commit()
View = objCopyDatabase.OpenView("INSERT INTO `Property` (`Property`,`Value`) VALUES ('USERHOME', '" & frmMain.txtUser.Text & "')")
View.Execute() : View.Close() : objCopyDatabase.Commit()
View = Nothing
objCopyDatabase.GenerateTransform(objOrigDatabase, strWorkingDir & strBaseMSTName & ".mst")
objCopyDatabase.CreateTransformSummaryInfo(objOrigDatabase, strWorkingDir & strBaseMSTName & ".mst", 0, 0)
objCopyDatabase.Commit()
objCopyDatabase = Nothing
objOrigDatabase = Nothing
objInstaller = Nothing
My.Computer.FileSystem.DeleteFile(tmpName)
Cheers
DiTcH
0 Comments
[ + ] Show comments
Answers (0)
Please log in to answer
Be the first to answer this question
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.