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 )
 
Back
Top