のレジストリのアンインストール エントリにキーを作成しようとしていますHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
が、コードを実行すると、代わりに にキーが作成されHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wow6432Node\Microsoft\Windows\CurrentVersion
ます。このパスがどこから取得されているのかわかりません。
以下は私が使用しているコードです
private void addToRegistry(string installPath)
{
using (RegistryKey parent = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", true))
{
if (parent == null)
{
MessageBox.Show("Failed to open registry key. Installation cannot continue", "Registry Error",
MessageBoxButton.OK, MessageBoxImage.Error);
}
try
{
RegistryKey key = null;
string appParent = "Boardies Email Server";
parent.CreateSubKey(appParent);
key = parent.OpenSubKey(appParent);
//key = parent.OpenSubKey(appParent, true) ??
// parent.CreateSubKey(appParent);
if (key == null)
{
MessageBox.Show("Failed to add registry entry. Error: nInstallation Aborted", "Registry Error",
MessageBoxButton.OK, MessageBoxImage.Error);
throw new Exception();
}
Assembly asm = GetType().Assembly;
Version version = asm.GetName().Version;
string exe = string.Format("{0}\\EmailServer.exe", installPath);
}
catch (Exception ex)
{
MessageBox.Show(string.Format("Failed to install, unable to insert into registry: {0}\n\nInstallation Aborted", ex.Message),
"Registry Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
ご協力いただきありがとうございます。