Windows フォームを使用してカスタム Windows インストーラーを作成しようとしています。インストール用に Windows フォームからインストール パスを受け入れることができるカスタム アクションを作成する方法。Windowsフォームから値を割り当てようとしてthis.Context.Parameters["targetdir"]
いますが、アプリケーションはデフォルトのパスにインストールされていますC:\Program Files (x86)\Microsoft\Setup1
.
public override void Install(IDictionary savedState)
{
base.Install(savedState);
const string key_path = "SOFTWARE\\VendorName\\MyAppName";
const string key_value_name = "InstallationDirectory";
RegistryKey key = Registry.LocalMachine.OpenSubKey(key_path, RegistryKeyPermissionCheck.ReadWriteSubTree);
if (key == null)
{
key = Registry.LocalMachine.CreateSubKey(key_path);
}
this.Context.Parameters["targetdir"] = default_installation_path;
string tgt_dir = this.Context.Parameters["targetdir"];
key.SetValue(key_value_name, tgt_dir);
}
インストーラークラスが初めての私を助けてください。