How to get the current directory of msi is running from?

Last post 12-03-2009 1:36 AM by maverickhyd. 2 replies.

Sort Posts:

  • How to get the current directory of msi is running from?

    11-30-2009, 12:22 AM
    • Contributor
      2,387 point Contributor
    • maverickhyd
    • Member since 03-25-2009, 6:38 AM
    • Posts 416

    Hi,

    I Created a setup file with Custom Actions.

    How can i get the Current directory of msi file is running?

    for ex:-

    I copied my installer on Desktop and installing.. in this case my current directory would be desktop location

    Any Help would be Greatly Appritiated!!

    Please Mark as Answer if it helped You!
  • Re: How to get the current directory of msi is running from?

    11-30-2009, 8:28 AM
    • All-Star
      54,501 point All-Star
    • DarrellNorton
    • Member since 04-04-2003, 3:49 PM
    • VA, USA
    • Posts 6,571
    • Moderator

    Try this:

    System.Reflection.Assembly.GetExecutingAssembly().Location

    and see if it returns the correct directory.  Sometimes it will return a temporary directory, so another option would be:

    AppDomain.CurrentDomain.BaseDirectory


    Darrell Norton, MVP
    Darrell Norton's Blog


    Please mark this post as answered if it helped you!
  • Re: How to get the current directory of msi is running from?

    12-03-2009, 1:36 AM
    • Contributor
      2,387 point Contributor
    • maverickhyd
    • Member since 03-25-2009, 6:38 AM
    • Posts 416

    Hi  DarrellNorton ,

    No, Both are returning "c:\windows\system32" only

     

    Please Mark as Answer if it helped You!
Page 1 of 1 (3 items)