How can I call an installer class on a button click event which read from the registry and also write a value in the registry in C#?
Asked
Active
Viewed 399 times
1
-
Do you want your button click to read/write to registry or to call an installer? Which is it? – Oded Feb 04 '11 at 08:48
-
what installer class do you mean? do you have a own class? – Fender Feb 04 '11 at 08:54
-
Now, when we have DTF for managed custom actions (http://wix.sourceforge.net/downloadv35.html), avoid Installer classes – Yan Sklyarenko Feb 04 '11 at 08:56
-
i want to read/write from registry when user click on button.but user have not all permission to write.at that time i have to use installer class to read/write in registry. so how can i do that – pankit Feb 04 '11 at 09:02
-
look there:http://stackoverflow.com/questions/2021831/c-admin-rights-for-a-single-methods you need to start this class with admin rights – Fender Feb 04 '11 at 09:07
1 Answers
0
This cannot be done with a single custom action. You should have 2 separate custom actions:
- one which is executed on button click and reads information from registry
- another one which writes information in registry during install
The second action needs Administrator privileges and should run as deferred with no impersonation in InstallExecuteSequence.
Assuming you want to set installer properties based on what is read from registry, using an Installer Class is not really an option. I recommend using a DLL custom action which gets a handle to the installer session. You can find a tutorial here: http://www.codeproject.com/KB/install/msicustomaction.aspx

Cosmin
- 21,216
- 5
- 45
- 60