How can I get runnig path of my application from app.xaml.cs itself?
A:
You can just use the System.Environment.GetCommandLineArgs property to get the command line that started the application. Parse that with the System.IO.Path methods to extract just the executable's filename or full path.
var exeName = System.IO.Path.GetFileName(
System.Environment.GetCommandLineArgs()[0]);
MessageBox.Show("This exe's filename is " + exeName);
Matt Hamilton
2009-09-08 06:06:26
+4
A:
You could try
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
AppDomain.CurrentDomain.BaseDirectory
and/or
Environment.CurrentDirectory
Mihai Lazar
2009-09-08 06:19:03