Getting calling Exe's name

  • Thread starter Thread starter AA2e72E
  • Start date Start date
A

AA2e72E

I expected

System.Reflection.Assembly.GetCallingAssembly().GetName().Name;

to give me the name of the exe calling a c# class library. It isn't - the c#
class library is a COM interrop dll and the calling exe is a Win32 Exe.

What am I doing wrong, any ideas?
 
Hello,

Likely because a win32 exe file is not an assembly... Perhaps by getting the
current process ?
 
I expected

System.Reflection.Assembly.GetCallingAssembly().GetName().Name;

to give me the name of the exe calling a c# class library. It isn't - the c#
class library is a COM interrop dll and the calling exe is a Win32 Exe.

What am I doing wrong, any ideas?

You could try:
Process.GetCurrentProcess().MainModule.FileName
and see if it works in this context.

A Win32 EXE is not a .NET assembly, so I am not surprised
that's not working.

Arne
 
I expected

System.Reflection.Assembly.GetCallingAssembly().GetName().Name;

to give me the name of the exe calling a c# class library. It isn't - the c#
class library is a COM interrop dll and the calling exe is a Win32 Exe.

What am I doing wrong, any ideas?

In addition to the other responses, if you have A.exe calling B.dll,
which in turn calls C.dll, then this function inside of C.dll shows B.dll.
 
Thank you all for the insights; for now, Arne's reply gives me what I needed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top