1

I'm trying to set a registry key containing the folder of installation of my app (which will be reused to install plugins afterwards) the problem is that when I run the installer, the registry doesn't get modified.

To add the registry key I right clicked the setup project>View>Registry, then in HKLM>SOFTWARE>[Manufacturor] I created a string value with "[INSTALLDIR]" or "[TARGETDIR]" but even the folder in SOFTWARE is not created though I changed the AlwaysCreate property to true.

Do I need to add something to validate that I want this registry modification applied? Thanks for reading

EDIT: as said in comments, I tried running the install as admin but didn't help, the installation runs totally fine except for the registry part. Tried looking at Custom Actions but I did not understand how to make it work for registry management(and I guess if there is a registry option, it should be easier this way, right?)

Phoque
  • 217
  • 3
  • 14
  • What level of user is running the installer? Does running as administrator help? – Ian Sep 19 '18 at 12:47
  • Running as admin doesn't help :/ that's the first thing I tried but no luck – Phoque Sep 19 '18 at 12:48
  • Please remember to update your question with what you've tried so new viewers can find the info without having to trawl through comments ;) Can you also show some code? It could be a simple problem in the code. – Ian Sep 19 '18 at 12:54
  • Well there is not really any code to show... install proceeds correctly, all files are copied where they are meant to it's just the registry part that doesn't seem to work. Or should I have code somewhere to make it work ? – Phoque Sep 19 '18 at 12:56
  • Is this 32-bit? – Ian Sep 19 '18 at 12:58
  • Yes, it is compiled as x86 – Phoque Sep 19 '18 at 12:59
  • 2
    Check under HKLM\SOFTWARE\Wow6432Node\ – Ian Sep 19 '18 at 12:59
  • Thanks @Ian that's where it went hiding... can I force it to go directly to Software for multi os purpose? I may need to install it on both x86 or x64 OSs so getting the value back may be a problem – Phoque Sep 19 '18 at 13:02
  • Not sure, but that's a different question ;) – Ian Sep 19 '18 at 13:05
  • For others looking for the same thing...Yes, you can force it to the x64 location by selecting the setup project properties and changing the TargetPlatform from x86 to x64. – Nathan Jul 22 '22 at 14:20

1 Answers1

0

I usually update regedit values after installation, when the app starts, checks and updates if necessary.

nadir
  • 63
  • 1
  • 11
  • Exception here is: one would like to add a registry so the app starts app with windows, and after user has done with installation, there is no guarantee that he will run the app first, he might just restart his machine, and upon login, the installed app won't startup, because no registry was added. – Starwave Oct 28 '19 at 20:54
  • ^ That's my problem at the moment. Try to stay away from Setup Projects built in Registry editor, there is a big gotcha - every time you start an app (but I believe it was from specific place, either desktop shortcut or start menu shortcut), the app checks what sort of registry keys were added when the app was installed. And if it doesn't find a key, it will automatically start a repair tool. So, for auto running apps on startup, I am trying to use an extended Install Class, and its "OnAfterInstall" method. Code runs fine, but no registry gets added. Also tried giving permissions, still ... – Starwave Oct 28 '19 at 20:59