How can I determine the currently running assembly?

  • You can determine the currently running assembly by using the Assembly class:

    C#:

    System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
    MessageBox.Show("The currently running assembly is: " + asm.Location);
    VB .NET:
    Dim asm As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
    MessageBox.Show("The currently running assembly is: " & asm.Location)
  • You can determine the starting executable as follows:

    C#:

    System.Reflection.Assembly asm = System.Reflection.Assembly.GetEntryAssembly();
    MessageBox.Show("The starting assembly is: " + asm.Location);
    VB .NET:
    Dim asm As System.Reflection.Assembly = System.Reflection.Assembly.GetEntryAssembly()
    MessageBox.Show("The starting assembly is: " & asm.Location)
  • You can determine the calling executable as follows:

    C#:

    System.Reflection.Assembly asm = System.Reflection.Assembly.GetCallingAssembly();
    MessageBox.Show("The calling assembly is: " + asm.Location);
    VB .NET:
    Dim asm As System.Reflection.Assembly = System.Reflection.Assembly.GetCallingAssembly()
    MessageBox.Show("The calling assembly is: " + asm.Location)


© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 01/11/03
Comment or report problem with topic