C
C#3y 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
Trinitek3y ago
put your mouse over the red squiggly, it tells you
apire
apireOP3y ago
it says there's no definition I replaced it with
AppDomain.CurrentDomain.BaseDirectory
AppDomain.CurrentDomain.BaseDirectory
Hope that works
Anchy
Anchy3y ago
Application.StartupPath is part of the Windows Forms library
apire
apireOP3y ago
ooh interesting what is the best alternative in WPF?
Trinitek
Trinitek3y 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
apireOP3y ago
I dont need that since I am building a C# Compiler It builds an another executable in the base dir
Want results from more Discord servers?
Add your server