0

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#

Tomerikoo
  • 15,737
  • 15
  • 35
  • 52
Trung Messi
  • 232
  • 2
  • 4

1 Answers1

0

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);
Eugene Astafiev
  • 34,483
  • 3
  • 16
  • 35
  • Thanks. But I got a detailed version. Now I want to get a Version of the build office – Trung Messi May 27 '21 at 10:31
  • Based on the detailed version you may find the version (2008 I guess on the picture). The versions and their build numbers are published in MSDN. – Eugene Astafiev May 28 '21 at 14:56
  • But in MSDN have many version...I can't get it by hand. I think it may be at the registry or anywhere on the computer. But I don't know – Trung Messi May 29 '21 at 14:01
  • You may find the [How to detect installed version of MS-Office?](https://stackoverflow.com/questions/3266675/how-to-detect-installed-version-of-ms-office) thread helpful. – Eugene Astafiev May 31 '21 at 21:22