I found solutions for Windows Forms with AppDomain but what would be the equivalent for a WPF Application
object?
views:
4636answers:
5
A:
String exePath = System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;
string dir = Path.GetDirectoryName(exePath);
Try this!
ArsenMkrt
2009-06-02 08:25:33
Not pretty, but works. Thanks :-)
Joey
2009-06-02 08:46:19
+19
A:
AppDomain.CurrentDomain.BaseDirectory
System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName)
Helen
2009-06-02 08:33:39
Ah, thanks. Must have overlooked AppDomain somehow. I was looking for it, actually ...
Joey
2009-06-02 12:34:05
+3
A:
Here is another:
System.Reflection.Assembly.GetExecutingAssembly().Location
Regards.
Eddie Butt
2009-06-04 03:23:27
Navigate to an arbitrary path on the command line, start the application by entering its full path and watch what happens to this property.
Joey
2010-03-02 11:46:13
A:
You can also use the first argument of the command line arguments:
String exePath = System.Environment.GetCommandLineArgs()[0]
Flip
2010-09-02 20:39:35