Example:
MyProgram.exe is executed. It calls MyClassLibrary1.dll which calls MyClassLibrary2.dll. How can I determine from within MyClassLibrary2.dll what the assembly version of MyProgram.exe is?
Is this possible?
Thanks.
Example:
MyProgram.exe is executed. It calls MyClassLibrary1.dll which calls MyClassLibrary2.dll. How can I determine from within MyClassLibrary2.dll what the assembly version of MyProgram.exe is?
Is this possible?
Thanks.
System.Reflection.Assembly.GetEntryAssembly().GetName().Version
EDIT My answer will only work if the DLL has a reference to the actually EXE which would be rather odd to do.
Try the following
typeof(SomeTypeInMyProgram).Assembly.GetName().Version
This will return a Version structure that you can use to analyze the version of MyProgram.exe.