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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top