Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

Assembly Info

Developing a DLL. Wanna get the following:

1. Version of the executing assembly, i.e. of the DLL; and
2. Full Name of the calling assembly, i.e the process (EXE) that it is executing in.

Because I have no application object inside the library project, I used (Reflection.Assembly's) GetExecutingAssembly & GetCallingAssembly to get the reference to the objects but I do not know how to go about from there.

Seems like both the methods return a reference to the DLL's assembly itself and not the process which called it. The FullName property returns a semi-colon delimited string that contains text that looks like a ProgId, version and some other stuff.

Help, help, help! A good tutorial on Reflections or the Assembly object that will save me the botheration of reading the documentation for the whole object.

Sathyaish Chakravarthy
Wednesday, January 05, 2005

You'll want System.Reflection.Assembly.GetEntryAssembly(), which gets you an Assembly reference. From there, call the GetName() method to get an AssemblyName reference which has a Version property.

System.Reflection.Assembly.GetEntryAssembly().GetName().Version should return the 4-part version number (x.x.x.x) of the process executable (the exe that started the current AppDomain).

Good luck.

Ryan LaNeve
Wednesday, January 05, 2005

*  Recent Topics

*  Fog Creek Home