To get the installation directory , where the application got installed we can use the COMMIT event of the installer class.Following are the steps we need to follow for getting the installation path :
In the custom actions window of setup project add the primary output for Install, Commit, Uninstall and Rollback.
Right click on the primary output of Commit tag and check the properties. Need to add /DIR=”[TARGETDIR]\” to the CustomActionData property.
In the Installer class add the following code in the commit event.
[VB.NET CODE STARTS]
Public Overrides Sub Commit(ByVal savedState As System.Collections.IDictionary)
Dim strInstallationDirPath As String = ""
' --This line gives the installation path as saved in the DIR variable in Custom Actions
strInstallationDirPath = Me.Context.Parameters.Item("DIR")
' You can now use the path and do whatever you need to