Open it with reflector and see whether it references one of the PresentationFramework DLLs (then it's likely WPF) or System. Windows. Forms. dll.
WPF is still one of the most used app frameworks in use on Windows (right behind WinForms).
For a WPF standalone application that is generated in Visual Studio using the New Project wizard, the entry point for the application is the Main function, defined in App. g. cs (generated code). In the default project, this is the public static void App.
One method:
System.AppDomain.CurrentDomain.BaseDirectory
Another way to do it would be:
System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName)
Here is another:
System.Reflection.Assembly.GetExecutingAssembly().Location
You can also use the first argument of the command line arguments:
String exePath = System.Environment.GetCommandLineArgs()[0]
I used simply string baseDir = Environment.CurrentDirectory;
and its work for me.
Good Luck
Edit:
I used to delete this type of mistake but i prefer to edit it because i think the minus point on this answer help people to know about wrong way. :) I understood the above solution is not useful and i changed it to string appBaseDir = System.AppDomain.CurrentDomain.BaseDirectory;
Other ways to get it are:
1. string baseDir =
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
2. String exePath = System.Environment.GetCommandLineArgs()[0];
3. string appBaseDir = System.IO.Path.GetDirectoryName
(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
Good Luck
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With