Reputation: 21155
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.
Upvotes: 0
Views: 709
Reputation: 422250
System.Reflection.Assembly.GetEntryAssembly().GetName().Version
Upvotes: 5
Reputation: 755457
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.
Upvotes: 0