Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Retrieve Installation Path

Retrieve Installation Path

Scheduled Pinned Locked Moved C#
questionwindows-adminworkspace
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    terrible83
    wrote on last edited by
    #1

    Hi, i've created a setup project and it works fine. Now i want to retrieve the installation path because i need to set it as current directory for the windows service i've created. How can i do it? I need to pass through windows registry (how?) or exists a variable or a property which i can read? Thank you all! Gianluca

    O L 2 Replies Last reply
    0
    • T terrible83

      Hi, i've created a setup project and it works fine. Now i want to retrieve the installation path because i need to set it as current directory for the windows service i've created. How can i do it? I need to pass through windows registry (how?) or exists a variable or a property which i can read? Thank you all! Gianluca

      O Offline
      O Offline
      originSH
      wrote on last edited by
      #2

      [TARGETDIR] is the property which contains the installation directory. You can add registry keys via the installer.

      1 Reply Last reply
      0
      • T terrible83

        Hi, i've created a setup project and it works fine. Now i want to retrieve the installation path because i need to set it as current directory for the windows service i've created. How can i do it? I need to pass through windows registry (how?) or exists a variable or a property which i can read? Thank you all! Gianluca

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #3

        terrible83 wrote:

        because i need to set it as current directory for the windows service i've created

        As someone pointed out in the past few days, best practice is to use absolute paths. To obtain the path you can access the installation path using the Windows Installer SDK in your service, that is what you are asking correct? However AFAIK this should work: System.Reflection.Assembly.GetExecutingAssembly().Location

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups