'Problem setting registry keys with windows installer in visual studio

I'm trying to make a windows-installer project that installs a windows-service. During the installation, I want the user to enter an SQL-connectionstring in a textbox.

I want the connectionstring to be saved in the registry so that the service can later use it.

I found a lot of examples online that i tried to follow but i can never get it to work properly for me.

I have 2 problems:

1: I can make a new key in "HKEY_CURRENT_USER" but not in "HKEY_LOCAL_MACHINE"

When i define the key in "HKEY_CURRENT_USER", the key is made as expected (manufacturer is "MyCompany")

Configuration + result

When i ctrl+X the key and paste it into "HKEY_LOCAL_MACHINE", the key won't show up in the registry.

Configuration

Do i need to do something else before I'm allowed to set a new key in "HKEY_LOCAL_MACHINE" or am i missing something else?

2: The string in the textbox isn't written to the registry

Below, i have 2 screenshots of how i configured the registry and user interfaces. I named the Edit-proporty of the textbox "P1" which I also use as the value of "ConnString". From what I understand, this should make it so that the user-input gets written to the registry, however, the registry-value will be literally "P1".

Config. Registry

Config. User Interface

I have tried dozens of different configurations, I just can't seem to make it work.

If you need more info or screenshots from me, please let me know. Thanks in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source