In my .msi installer package, I have a C# custom action that writes a registry value in:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
The custom action is deferred because I need elevated privileges for some of the keys I am trying to install. However, because it is deferred, this action writes to the current user of the system account since it is launched with elevated permissions, so my registry value actually gets written in:
HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Run
How can I get the installer to write this registry value into the registry of the user who launched the installation package instead of the system account's registry?
Do you try this, here reference from microsoft
Edit:
Try this, you should probably read about
Registry.Users.SetValue
You need:
for this code.