views:

125

answers:

3

I am using C# for this application.

I have a DLL that gets included within my application. From this DLL, I need to find the Assembly Version of the main program in which this DLL is included.

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() does not return what I want. This returns the Assembly version of the DLL, not the main program.

How do I get the version information from the main program?

+6  A: 
System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString()

is the right one.

Vitaliy Liptchinsky
I don't believe this is what OP is asking.
Groo
What about GetCallingAssembly?
leppie
`Config.AppOldVersion = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString();` Worked for me. Thank you
Andy
A: 

try:

Application.ProductVersion.ToString();
Wael Dalloul
A: 

Sorry for not replying directly (new user...just registered an account).

@Eclipsed4utoo - Yes, the DLL will be returning the version of the parent. This DLL will be an autoupdate library. To determine if the version of the code available online should be downloaded, the current version will be needed. Since I plan I adding this to several projects, I figured a DLL would be most useful - so it needs the application's version, not it's version.

Andy