windows - Programmatically Determine Version of Office 2016 After Reverting to Previous Version C# -


i'm developing program needs confirm version of office 2016 user running, , ensure version compatible. in order compatible, user may need downgrade version of office 2016 (16.0.xxxx.xxx) previous version (16.0.yyyy.yyyy).

according microsoft documentation, can programmatically revert previous version. after doing this, can open 1 of office programs, >file >account , see if version has reverted or not.

however, when run program confirm newly reverted version of office (16.0.yyyy.yyyy), returns original version before reverting (16.0.xxxx.xxxx). since i'm searching registry, have tried restarting machine set , update changes in registry, has not helped. programmatically, i'm still returning wrong version (but in office program, shows me reverted version want.)

how can determine version of office 2016 running right on computer, if it's previous, reverted version?

my code of right (determine if app installed):

string currentversion = string.empty; string registrynamec2r = "office 16 click-to-run extensibility component"; string registrykey = @"software\microsoft\windows\currentversion\uninstall"; using (microsoft.win32.registrykey key = microsoft.win32.registry.localmachine.opensubkey(registrykey)) {     foreach (string subkeyname in key.getsubkeynames())     {         using (microsoft.win32.registrykey subkey = key.opensubkey(subkeyname))         {             string displayname = (string)subkey.getvalue("displayname");             if (displayname != null)             {                 if (displayname.contains(registrynamec2r))                 {                     currentversion = (string)subkey.getvalue("displayversion"); //this gives me version before reverted                 }             }         }      } } 


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -