Trung Messi
Trung Messi

Reputation: 352

How to get Version Number by Build Number Office

I'm working VSTO and I have an issue. I want to get a Version of Office but I can't

enter image description here

I want to get 2008

Please help me! Thanks

I'm using C#

Upvotes: 1

Views: 428

Answers (1)

Eugene Astafiev
Eugene Astafiev

Reputation: 49395

You can get the file version information of the Office application.

// Retrieve the path e.g. from the InstallRoot Registry key
var fileVersionInfo = FileVersionInfo.GetVersionInfo(@"C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE");
var version = new Version(fileVersionInfo.FileVersion);

// or you can get the information from the running instance using the `Process` class
var process = Process.GetProcessesByName("winword").First();
string fileVersionInfo = process.MainModule.FileVersionInfo.FileVersion;
var version = Version(fileVersionInfo);

Upvotes: 1

Related Questions