Passing REINSTALLMODE to an MSI file

前端 未结 2 763
长发绾君心
长发绾君心 2020-12-31 21:32

I am using VisualStudio2005 and a vdproj to create a simple MSI file. I need to pass in the REINSTALLMODE property when I launch it.

I know this can be done via c

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-31 22:35

    I found a more automated way to do this.

    Create a script named add_reinstall_prop.vbs(example) with the folowing:

    set objArgs = WScript.Arguments
    set o_installer = CreateObject("WindowsInstaller.Installer")
    set o_database = o_Installer.OpenDatabase(objArgs(0), 1)
    s_SQL = "INSERT INTO Property (Property, Value) Values( 'REINSTALLMODE', 'amus')"
    set o_MSIView = o_DataBase.OpenView( s_SQL)
    o_MSIView.Execute
    o_DataBase.Commit
    

    Add a post-build event to your setup project calling the script with the following:

    add_reinstall_prop.vbs $(BuiltOuputPath)
    

    This will automatically add the desired entry to the built MSI. You can then check it with Orca to see the entry is now added automatically after build.

提交回复
热议问题