Getting the calling assembly name in the client library

A client library ( ClientLib.dll) class has a method to derive the calling assembly name as

string applicationName = Assembly.GetEntryAssembly().GetName().Name;

If the above library is referred in Win app or other library, the applicationName is set to calling (entry) assembly name.

But when above client library is referred in the webservice assembly (WsAssembly.dll), the entry assembly name is null but the executing assembly name is client library name(ClientLib), ideally I want the applicationName set to WsAssembly.

Any ideas on deriving the calling or entry assembly name both for web applications and windows application is appreciated.

Thanks
Srik


Answer this question

Getting the calling assembly name in the client library

  • RajaGanapathy

    no... you should not matter.

    I tried that.... and in aspnet appdomains the GetEntryAssembly returns null.... but the GetCallingAssembly was returning the temp dll created by aspnet to execute the code.... once this gets compiled for deployment it should get the WSAssemby.dll....

    If it doesn't work.... you may try using the StackTrace and StackFrame classes from System.Diagnostics namespace to get the full invocation stack.

    Rgds

    Rodrigo


  • DarelLuechtefeld

    Appreciate your response Rodrigo,
    GetCallingAssembly() returns Client assembly name (ClientLib) which is same as GetExecutingAssembly().. Actual call is in a static class should that matter in web application

    Thanks
    Srik

  • M.A.T

    What about using GetCallingAssembly instead of GetEntryAssembly

    Rgds

    Rodrigo


  • Getting the calling assembly name in the client library