1

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
  • 18,379
  • 16
  • 47
  • 61
Trung Messi
  • 322
  • 3
  • 5

1 Answers1

1

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
  • 47,483
  • 3
  • 24
  • 45
  • 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
  • 1
    After looking for so long, your first example was the only good way I found to get the full version + build version. Thank you! – gusmally supports Monica Feb 02 '23 at 02:19