How can i Get application Path

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • girdhar

    How can i Get application Path

    I have created a project in "c:\myproje ct\" directory

    how can i access this path in c#.
    I have a XML File in this same directory and i want to load this file
    using xmldom.load method.

  • Gabriel Lozano-Morán

    #2
    Re: How can i Get application Path

    System.Environm ent.CurrentDire ctory

    Gabriel Lozano-Morán

    "girdhar" <girdhar@discus sions.microsoft .com> wrote in message
    news:50789E88-A5DB-436E-B1F0-7EFA93B053F2@mi crosoft.com...[color=blue]
    >I have created a project in "c:\myproje ct\" directory
    >
    > how can i access this path in c#.
    > I have a XML File in this same directory and i want to load this file
    > using xmldom.load method.
    >[/color]


    Comment

    • Jingnan Si

      #3
      Re: How can i Get application Path

      girdhar wrote:[color=blue]
      > I have created a project in "c:\myproje ct\" directory
      >
      > how can i access this path in c#.
      > I have a XML File in this same directory and i want to load this file
      > using xmldom.load method.
      >[/color]
      AppDomain.Curre ntDomain.BaseDi rectory can return the running assembly path.

      Comment

      • Gelios

        #4
        Re: How can i Get application Path

        Gabriel Lozano-Morán wrote:[color=blue]
        > System.Environm ent.CurrentDire ctory
        >
        > Gabriel Lozano-Morán
        >
        > "girdhar" <girdhar@discus sions.microsoft .com> wrote in message
        > news:50789E88-A5DB-436E-B1F0-7EFA93B053F2@mi crosoft.com...
        >[color=green]
        >>I have created a project in "c:\myproje ct\" directory
        >>
        >>how can i access this path in c#.
        >>I have a XML File in this same directory and i want to load this file
        >>using xmldom.load method.
        >>[/color]
        >
        >
        >[/color]

        Environment.Cur rentDirectory returns the fully qualified path of the current directory; that is, the directory from which this process starts.

        Comment

        • Mattias Sjögren

          #5
          Re: How can i Get application Path

          >the current directory; that is, the directory from which this process starts.

          The current directory isn't necessarily the startup directory.



          Mattias

          --
          Mattias Sjögren [MVP] mattias @ mvps.org
          http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
          Please reply only to the newsgroup.

          Comment

          • Gabriel Lozano-Morán

            #6
            Re: How can i Get application Path

            You can change the current directory using
            System.IO.Direc tory.SetCurrent Directory() I was wrong to assume that his
            ..EXE runs in c:\myproject\

            Gabriel Lozano-Morán

            "Gelios" <gelios@rbcmail .ru> wrote in message
            news:d4vlki$2jq f$3@gavrilo.mtu .ru...[color=blue]
            > Gabriel Lozano-Morán wrote:[color=green]
            >> System.Environm ent.CurrentDire ctory
            >>
            >> Gabriel Lozano-Morán
            >>
            >> "girdhar" <girdhar@discus sions.microsoft .com> wrote in message
            >> news:50789E88-A5DB-436E-B1F0-7EFA93B053F2@mi crosoft.com...
            >>[color=darkred]
            >>>I have created a project in "c:\myproje ct\" directory
            >>>
            >>>how can i access this path in c#.
            >>>I have a XML File in this same directory and i want to load this file
            >>>using xmldom.load method.
            >>>[/color]
            >>
            >>
            >>[/color]
            >
            > Environment.Cur rentDirectory returns the fully qualified path of the
            > current directory; that is, the directory from which this process starts.[/color]


            Comment

            • RodW

              #7
              RE: How can i Get application Path

              public class Globals
              {
              public static string AppHomeDir; // app’s home dir (e.g. where .EXE
              lives)
              static Globals()
              {
              AppHomeDir = System.AppDomai n.CurrentDomain .BaseDirectory;
              }
              }

              "girdhar" wrote:
              [color=blue]
              > I have created a project in "c:\myproje ct\" directory
              >
              > how can i access this path in c#.
              > I have a XML File in this same directory and i want to load this file
              > using xmldom.load method.
              >[/color]

              Comment

              Working...