C
C#2y ago
apire

Application.StartupPath

I am using WPF C# and I am trying to use Application.StartupPath but as u can see I can not use this method, why's that?
6 Replies
Trinitek
Trinitek2y ago
put your mouse over the red squiggly, it tells you
apire
apire2y ago
it says there's no definition I replaced it with
AppDomain.CurrentDomain.BaseDirectory
AppDomain.CurrentDomain.BaseDirectory
Hope that works
Anchy
Anchy2y ago
Application.StartupPath is part of the Windows Forms library
apire
apire2y ago
ooh interesting what is the best alternative in WPF?
Trinitek
Trinitek2y ago
you can import System.Windows.Forms and use Application.StartupPath if you want the other popular suggestion seems to be AppDomain.CurrentDomain.BaseDirectory Process.GetCurrentProcess().MainModule.FileName is another suggestion, which includes the name of the currently running exe
apire
apire2y ago
I dont need that since I am building a C# Compiler It builds an another executable in the base dir