Application path

  • Thread starter Thread starter Wim
  • Start date Start date
W

Wim

Hello,

I'm looking for the C# equivalent of App.Path (that is the application
path in Visual Basic). I think it is
System.Security.Policy.ApplicationDirectory.Directory, but when I use
this the compiler says: "An object reference is required for the
nonstatic field, method, or property
'System.Security.Policy.ApplicationDirectory.Directory'"
 
Hi,

Did you tried:

Application.StartupPath :

Gets the path for the executable file that started the application, not
including the executable name.

Cheers,
 
Hi,

Try Directory.GetCurrentDirectory(). this will give the
working directory for the application.

Regards,
Madhu

MVP | MCSD.NET
 
What do you think about:

System.Reflection.Assembly.GetExecutingAssembly.Location

I think is better than:

System.Windows.Forms.Application
 
FG said:
What do you think about:

System.Reflection.Assembly.GetExecutingAssembly.Location

I think is better than:

System.Windows.Forms.Application

In what way would that be better?
 
Back
Top