Link to home
Start Free TrialLog in
Avatar of vikasbapat
vikasbapat

asked on

Installer Custom Action in msi setup

Hi guys,

I am developing a windows installer for my windows application. What I do is during the installation ,at the end, the setup asks for login credentials. I have overriden the commit method of installer class thus causing custom action to fire.

Here is my code :

    <Security.Permissions.SecurityPermission(Security.Permissions.SecurityAction.Demand)> _

Public Overrides Sub Commit(ByVal savedState As  _

  System.Collections.IDictionary)

 

        MyBase.Commit(savedState)

 

 

        If Not File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\DBConnect.xml") Then

            Dim frm As New Login

            frm.TopMost = True

            frm.ShowDialog()

            frm.BringToFront()

            frm.Activate()

            frm.Focus()

            frm.WindowState = Windows.Forms.FormWindowState.Maximized

 

This works perfectly . But now I want to fire this custom action afetr installation has been completed so I have modified the code as:

 

  Protected Overrides Sub OnAfterInstall(ByVal savedState As IDictionary)

        MyBase.OnAfterInstall(savedState)

        ' Add steps to be done after the installation is over.

        If Not File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\DBConnect.xml") Then

            Dim frm As New Login

            frm.TopMost = True

            frm.ShowDialog()

            frm.BringToFront()

            frm.Activate()

            frm.Focus()

            frm.WindowState = Windows.Forms.FormWindowState.Maximized

 

 

        End If

 

    End Sub 'OnAfterInstall

 

        End If


So  as you can see I have used OnAfterInstall methos to override .But my problem is
The custom action still fires before the installation & not after installation is completed.

Any help  ill be appreciated

ASKER CERTIFIED SOLUTION
Avatar of Vadim Rapp
Vadim Rapp
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial