2

How to find version of an application installed, using c#. Is there a way to know component id of application?

EDIT: I need to get version of an already installed application.This is required for generating the diagnostics report on users machine.

Example:Version of Outlook 2007 installed on a user's machine

3
  • 1
    Do you want the version of the currently running application or another application which is out of your program? Commented Jun 8, 2010 at 9:46
  • yes, please look at the EDIT in question Commented Jun 8, 2010 at 18:16
  • Here is a relevant answer Commented Jul 22, 2024 at 9:59

3 Answers 3

2

If it's assemblies you're after:

For the current assembly:

Assembly.GetExecutingAssembly().GetName().Version

Replace Assembly.GetExecutingAssembly() with an Assembly instance you got through other means to determine that one's version.

One way would be:

Assembly assembly = Assembly.LoadFrom("something.dll");

It will return the value from the AssemblyVersion attribute.

Sign up to request clarification or add additional context in comments.

Comments

1
FileVersionInfo.GetVersionInfo("some.dll");

1 Comment

This approach we have find the dll(s) copied by application installer/update to application and find the version of dll.
0

There is no unified method suitable for all the applications I'm afraid. But for MS office application you may get version via COM objects.

Sorry, I don't have outlook on my computer, so I can't try it with oulook. But with excel and word it can be done like that:

Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
Console.WriteLine("Excel: Version-" + excelApp.Version + " Build-" + excelApp.Build);
Console.WriteLine("Word: Version-" + wordApp.Version + " Build-" + wordApp.Build);

I think that getting version of other MS applications will be quite the same. Good luck.

PS. Do not forget to call Quit() in the end and to release com objects via Marshal.ReleaseComObject() method like

Marshal.ReleaseComObject(excelApp);
Marshal.ReleaseComObject(wordApp);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.