Pages

Monday, August 10, 2009

.NET: Getting the Path of the Executing Assembly

To retrieve the path of the executing assembly (the VB 6.0 equivalent of App.Path), use the following code:

[C#]
String strPath = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().CodeBase);

[Visual Basic]
Dim strPath As String = System.IO.Path.GetDirectoryName( _
System.Reflection.Assembly.GetExecutingAssembly().CodeBase)

 


Original post can be found here