How to get the Calling Assembly in C# or VB.NET

To get the Calling Assembly in C# or VB.NET you can use Reflection.

Sample C#

using System.Reflection;

public static string GetCallingAssemblyName()
{
var callingAssembly = Assembly.GetCallingAssembly();
return callingAssembly.FullName;
}

Sample VB.NET

Imports System.Reflection

Public Shared Function GetCallingAssemblyName() As String
    Dim callingAssembly = Assembly.GetCallingAssembly()
    Return callingAssembly.FullName
End Function

for more informations see the MSDN: Reflection (C# and Visual Basic), Assembly.GetCallingAssembly Method

Please Share us:
Please rate this snippet

2 thoughts on “How to get the Calling Assembly in C# or VB.NET

Leave a Reply