How to locate the startup for .NET .DLL?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

Thanks for reviewing my question. I have written a .NET .DLL and I would like to know how I can find out its start up folder at run-time? I know in Win32 you can use GetModuleName() to find out but how do you do it in the .NET Framework

Many Thanks to the Expert
Pete
 
system.environment.currentdirectory

is this what your after?


Peter said:
Hello,

Thanks for reviewing my question. I have written a .NET .DLL and I would
like to know how I can find out its start up folder at run-time? I know in
Win32 you can use GetModuleName() to find out but how do you do it in the
..NET Framework?
 
I figured it out. You can do either two ways shown below

Assembly mainAssembly = Assembly.GetExecutingAssembly()
Console.WriteLine("Location is {0}", mainAssembly.Location )

Module mainMod = mainAssembly.GetModules()[0]
Console.WriteLine("Location is {0}", mainMod.FullyQualifiedName )
 

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