c# - Visual Studio Setup Project custom actions are not finding the correct registry keys in Current User -


our software requires user has either excel 2010 or 2013 installed before can finalize our installation. using visual studio setup project (vdproj) custom actions check hkey_current_user\software\microsoft\office either 14.0\excel or 15.0\excel ensure there. code looks this:

registrykey currentuser = registry.currentuser.opensubkey(@"software\microsoft\office"); if (currentuser != null) {     foreach (key in currentuser.getsubkeynames())     {         if (key == "14.0")         {             // excel 2010 installed         }         else if (key == "15.0")         {             // excel 2013 installed         }     } } 

the current implementation has not been changed little on year , haven't had issues before. however, have seen machines not returning of sub key names. machines affecting returning "outlook" key , nothing else, despite fact there "15.0" key many others exist in location.

this not issue x86 vs x64 since hkcu\software\wow6432node\microsoft\office not exist on machines. regardless, did try registrykey.openbasekey(registryhive.currentuser, registryview.registry64), did not seem help.

the issue stems recent windows update (see relevant kb article explanation , possible workaround).

when specifying registry.currentuser elevated privileges, doesn't use hkey_current_user registry hive, rather hkey_users\.default. sub key names returned currentuser.getsubkeynames() keys found in hkey_users\.default\software\microsoft\office. able work around forgetting registry.currentuser entirely , using registrykey.openbasekey(registryhive.localmachine, registryview.registry64) instead.

if absolutely needs use hkey_current_user, haven't tried myself this answer + comments might relevant.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -