Running application after installation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dreamfalcon
    New Member
    • Oct 2007
    • 20

    Running application after installation

    Hi!

    I created a service, a windows form and a setup project in VB.NET.

    And after install I need the installation directory to do something like this:

    Code:
        Private Sub ServiceProcessInstaller1_AfterInstall(ByVal sender As System.Object, ByVal e As System.Configuration.Install.InstallEventArgs) Handles ServiceProcessInstaller1.AfterInstall
                Dim path As String = Me.TARGETDIR 'not working
                If System.IO.File.Exists(path & "res.dll") Then
                    Microsoft.VisualBasic.Shell("net start update_service")
                Else
                    Microsoft.VisualBasic.Shell(path & "activate.exe")
                End If
        End Sub
    The problem is how to get the installation dir?

    Can anyone help me?
    thx
  • dreamfalcon
    New Member
    • Oct 2007
    • 20

    #2
    Please, anyone?
    i'm stuck at this

    Comment

    • hini
      New Member
      • Mar 2007
      • 23

      #3
      I am not sure if the value can be accessed directly from the classes of the solution, especially that it depends on the deployment application

      you may try to search the installation directory by reading the windows registry using a code similar to this one :

      RegistryKey bk = Registry.LocalM achine;
      RegistryKey rk;
      string subkey = @"System\Curren tControlSet\Ser vices\yourservi cename";
      rk = bk.OpenSubKey(s ubkey);
      MessageBox.Show (rk.GetValue("I magePath").ToSt ring());

      this code searches for your service and gets the path of the exe that runs the service.
      hope this will help.

      Comment

      • dreamfalcon
        New Member
        • Oct 2007
        • 20

        #4
        Originally posted by hini
        ...
        you may try to search the installation directory by reading the windows registry using a code similar to this one :
        ...
        It works.
        Many thx :)

        Comment

        Working...