C# Registry does not create key in the correct place?

Brian Wheatley 21 Reputation points
2022-08-06T14:45:21.41+00:00

I can successfully open the parent key:

RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\CLASSES\CLSID\", true);

When I look at the key by setting a break point an hovering over it with the mouse the proper path shows. However, when I create a subkey using the code below it does not appear on that path in the registry.

key.CreateSubKey("{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}");

Using the search function in the registry editor I find the key has instead been placed in the path Computer\HKEY_CLASSES_ROOT\WOW6432Node\CLSID\

How do I get this to go to the correct location?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,300 questions
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 40,771 Reputation points
    2022-08-06T14:51:16.463+00:00

    Your are creating your subkey in the 32-bit view of the registry because you have most likely created a 32-bit application.

    Make sure that you build your application for x64 or that if you build for AnyCPU that prefer 32-bit is unchecked.

    0 comments No comments

0 additional answers

Sort by: Most helpful