比如说别人已经写好了个服务并且可以顺利安装,当安装后我把那个服务代码copy了一遍
改了点点的里面可以变动的东西,再次安装的时候系统说已经改服务应经是最新本版?
请教下,当我再次安装该服务不卸载以前的服务的时候 我是不是要修改下代码中的注册表? private string GetInstallPath()
{
string InstallPath = string.Empty;
RegistryKey pregkey;
RegistryKey HRMPTKey;
pregkey = Registry.LocalMachine.OpenSubKey("Software", true);
if (pregkey == null)
{
throw new Exception("键值不存在");
}
else
{
try
{
HRMPTKey = pregkey.OpenSubKey("HRMPT", true);
if (null != HRMPTKey)
{
InstallPath = HRMPTKey.GetValue("ProductPath").ToString();
HRMPTKey.Close();
}
}
catch (Exception ex)
{
throw new Exception("设置注册表出错!");
}
finally
{
}
} pregkey.Close();
return InstallPath;
}
改了点点的里面可以变动的东西,再次安装的时候系统说已经改服务应经是最新本版?
请教下,当我再次安装该服务不卸载以前的服务的时候 我是不是要修改下代码中的注册表? private string GetInstallPath()
{
string InstallPath = string.Empty;
RegistryKey pregkey;
RegistryKey HRMPTKey;
pregkey = Registry.LocalMachine.OpenSubKey("Software", true);
if (pregkey == null)
{
throw new Exception("键值不存在");
}
else
{
try
{
HRMPTKey = pregkey.OpenSubKey("HRMPT", true);
if (null != HRMPTKey)
{
InstallPath = HRMPTKey.GetValue("ProductPath").ToString();
HRMPTKey.Close();
}
}
catch (Exception ex)
{
throw new Exception("设置注册表出错!");
}
finally
{
}
} pregkey.Close();
return InstallPath;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货