Use Orca to edit msi from command line?

前端 未结 5 1602
我寻月下人不归
我寻月下人不归 2020-12-08 03:20

I\'m using Visual Studio 2008 and have created a setup project for my application. The application has a high-resolution icon (for Vista). There\'s a bug in Visual Studio, a

5条回答
  •  悲哀的现实
    2020-12-08 03:33

    I just had to do this too - here is my VBScript file (in case it's useful to anyone)...

    Dim msiInstaller
    Dim msiDatabase
    Dim msiView
    Dim msiRecord
    
    Dim pathToMsiFile
    Dim pathToIconFile
    
    If WScript.Arguments.Count <> 2 Then
        WScript.Echo "Usage:" & vbCrLf & "  " & WScript.ScriptName & "  "
        WScript.Quit
    End If
    
    Dim pathToMsi, pathToIcon
    pathToMsi = WScript.Arguments(0)
    pathToIcon = WScript.Arguments(1)
    
    Set msiInstaller = CreateObject("WindowsInstaller.Installer")
    
    Set msiRecord = msiInstaller.CreateRecord(1)
    msiRecord.SetStream 1, pathToIcon
    
    Set msiDatabase = msiInstaller.OpenDatabase(pathToMsi, 1)
    Set msiView = msiDatabase.OpenView("UPDATE Icon SET Data = ? WHERE Name <> ''")
    msiView.Execute msiRecord
    
    msiDatabase.Commit
    

    This script replaces all shortcut icons in the MSI database with a single icon - if you need to be selective then you have some more work to do.

提交回复
热议问题