Finding Program Location using Reflection

  • Thread starter Thread starter Joe Keller
  • Start date Start date
J

Joe Keller

Hello,

Is there a way for me to programmatically discover the location that my .EXE
is running in? This was easy in VB6 as I just used the "App" object. Does
C# have something similar?

Thanks,

Joe
 
Joe,

using System.Reflection;

....

string exePath = Assembly.GetExecutingAssembly().GetName
().CodeBase
 
Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName is the
name of your assembly with full path
 
Back
Top