get application directory
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: get application directory

  1. #1
    Join Date
    Jul 2001
    Posts
    430

    get application directory

    how to get the application directory? in vb, it is app.path, but i don't know in c#. thanks

  2. #2
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: get application directory

    Try these :

    Code:
    public class Example
    {
        static public string ApplicationPath
        {
            get
            {
                return System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
            }
        }
    
        static public string EntryAssemblyPath
        {
            get
            {
                return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            }
        }
    }
    The first one will work for WinForms applications, the second for console-based applications.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  3. #3
    Join Date
    May 2004
    Location
    Greenville, NC
    Posts
    193

    Re: get application directory

    Code:
    Application.StartupPath
    Jason Isom
    .NET 2.0 / VS2005 Developer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center