Visual Studio 2022 Question

OSVBNET 1,386 Reputation points
2022-05-03T11:35:31.007+00:00

Hello,
Kind of strange question, but each time I install VS 2022 Pro, it's installed in a different registry location:

HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\c238312c
or
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\497fffa9
etc...

The ending string (KEY) changes with each install, need to update "DisplayName" value in a .bat file, after vs.net install, how to deal with that? :(

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,354 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 56,261 Reputation points
    2022-05-03T15:02:44.873+00:00

    The value after Uninstall can be anything. The only requirement from Windows is that it is unique. Some apps use their names while other apps use a GUID that they have generated. It is not something you can code against.

    I'm not sure what you're trying to do exactly but if you want to find the VS installations then the preference is to use VSWhere. But if you must scan the registry then you'll need to look in all the subkeys. You'll need to do a fuzzy match on DisplayName to find the Visual Studio* entry(ies) and then you can rename from there. AFAIK there is no way to find the uninstall key otherwise as this is just standard Windows stuff.

    Alternatively you could probably use WMI to get the installed apps and get the registry key from there but you'll still end up doing a match against the product name, not the underlying registry key.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.