I have some code in the Custom Actions editor as I need to install & Uninstall steps of certain process. I have also marked the CustomActionData property as :
/TARGETDIR = "[TARGETDIR]"
in the properties window
Hope the above will pass installation directory info in to the custom action.
It seems to be firing, but my problem is, I have received the following error message:
"Error 1001. Can't write to register's key" (or something like that, I'm translating it from my local language).
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
const string key_path = "SOFTWARE\\VendorName\\MyAppName";
const string key_value_name = "InstallationDirectory";
RegistryKey key = Registry.LocalMachine.OpenSubKey(key_path);
if (key == null)
{
key = Registry.LocalMachine.CreateSubKey(key_path);
}
string tgt_dir = Context.Parameters["TARGETDIR"];
key.SetValue(key_value_name, tgt_dir);
}
I'm not sure what I did wrong.
Linda
/TARGETDIR = "[TARGETDIR]"
in the properties window
Hope the above will pass installation directory info in to the custom action.
It seems to be firing, but my problem is, I have received the following error message:
"Error 1001. Can't write to register's key" (or something like that, I'm translating it from my local language).
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
const string key_path = "SOFTWARE\\VendorName\\MyAppName";
const string key_value_name = "InstallationDirectory";
RegistryKey key = Registry.LocalMachine.OpenSubKey(key_path);
if (key == null)
{
key = Registry.LocalMachine.CreateSubKey(key_path);
}
string tgt_dir = Context.Parameters["TARGETDIR"];
key.SetValue(key_value_name, tgt_dir);
}
I'm not sure what I did wrong.
Linda