我有一个MSI安装程序来安装我的Windows服务,并且在我的自定义操作中,我需要在HKEY_LOCAL_MACHINE/SOFTWARE/MYSoftware
注册表项中写入一些值到注册表中。无法在MSI安装程序的自定义操作中写入注册表
我想这样做,它不工作,但从我的Windows服务它工作正常。有人可以告诉我我哪里出错了吗?
string registryLocaltion = AgentProperties.TMAGENT_REGISTRY_LOCATION
+ @"\" +AgentProperties.TMAgentVersion;
tmKeyMain = Registry.LocalMachine.OpenSubKey(registryLocaltion, true);
if (tmKeyMain == null)
{
log.Error("Unable to open registry key " + registryLocaltion);
}
tmKeyMain.SetValue("UseProxySettings", settings.UseProxySettings);
if (settings.UseProxySettings)
{
tmKeyMain.SetValue("ProxyHost", settings.ProxyHost);
tmKeyMain.SetValue("ProxyPort", settings.ProxyPort);
tmKeyMain.SetValue("ProxyUsername",
GenericHelper.ConvertToBase64Encoding(settings.ProxyUsername));
tmKeyMain.SetValue("ProxyPassword",
GenericHelper.ConvertToBase64Encoding(settings.ProxyPassword));
tmKeyMain.SetValue("ProxyExclusion", settings.ProxyExclusion);
tmKeyMain.SetValue("BypassProxy", settings.BypassProxy);
}
此代码是在我的Windows服务工作正常,但如果我做一些事情非常相似,在MSI安装程序我的自定义操作,这是行不通的。
有人可以告诉我我要去哪里吗?
我正确地猜测您正在使用InstallUtil(安装程序类)自定义操作并使用Visual Studio部署项目创作您的MSI? – 2013-05-13 14:31:35
是的,你是对的... 我做错了什么.. ?? – 2013-05-14 03:16:37