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

vikasbapatAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vadim RappCommented:
Not a definitive answer, but I would be surprised if Installer allowed doing anything after the commit. Most likely it simply can't commit with your custom action in progress, so it postpones the commit until custom action has finished. It's like baron Minhauzen who tried to get out of the lake by pulling his own hair up.

Usually, when something needs to be done before or after the installation, it goes into the setup.exe. But I'm sure you realize that the whole idea is breaking the concept of the installation being able to rollback -if for whatever reason your after-commit code fails, the system will be left in intermetiate state.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Installation

From novice to tech pro — start learning today.