I have a c# windows client app packaged using ClickOnce. Using c# how can I programmatically get the registry entry for that application? As I am wanting to write a registry entry for a child app NEAR the same location
AFAIK, the only registry key ClickOnce might create is the key related to displaying the application in the system's Add/Remove Programs control panel for uninstall purposes. I doubt this is what you want. It is not appropriate to write configuration settings there. Thus, there is no existing "registry entry for that application" for you to get.
If you want to store settings, there is a whole "application settings" infrastructure for this. It is file-based, not registry-based. It play well with ClickOnce.
See: http://msdn.microsoft.com/en-us/library/0zszyc6e.aspx
You can, of course, create a registry entry yourself in any part of the registry where the user has suitable access. The class for doing this is Microsoft.Win32.Registry
: http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.aspx
A good choice of registry location would be HKEY_CURRENT_USER\Software\YourCompanyName\YourProductName
.
U can define and get a registry key like this.
// Define a key
Microsoft.Win32.RegistryKey key;
key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("AppName");
key.SetValue("AppName", "Cracker");
key.Close();
// Retrieving data
object keyData = Microsoft.Win32.Registry.CurrentUser.GetValue("AppName");
Read more from http://msdn.microsoft.com/en-us/library/h5e7chcf.aspx