I require a MSI Custom action that copies a file from the MSI source directory

后端 未结 4 858
攒了一身酷
攒了一身酷 2021-01-05 22:53

I\'m creating a installer for a c# windows project using VS 2008. I\'m trying to write a custom action that copies a settings file from the source directory of the MSI file

4条回答
  •  悲&欢浪女
    2021-01-05 23:27

    I have solved this by adding

    /InstallerPath="[OriginalDatabase]"

    to the CustomActionData of the Custom Action (in the Tab Custom Actions of the Setup Project) and reading the value with this code in the Custom Action:

        Public Overrides Sub Commit(ByVal savedState As System.Collections.IDictionary)
            MyBase.Commit(savedState)
    
            Dim directoryOfMSI As String = IO.Path.GetDirectoryName(Context.Parameters("InstallerPath"))
    
            'Do your work here
            '...
    
        End Sub
    

    Ciao! Stefan

提交回复
热议问题