我有一个带自定义单选按钮对话框的Visual Studio安装程序项目。
当在UI中选择ButtonProperty后,如何使其将值写入注册表?
我有一个带自定义单选按钮对话框的Visual Studio安装程序项目。
当在UI中选择ButtonProperty后,如何使其将值写入注册表?
Pipe the data through to your Custom Action using CustomActionData eg: If your property is called MYPROP: /MyVar=[MYPROP]
You can now access the data from your installer class:
protected override void OnAfterInstall(IDictionary savedState) {
string myVar = Context.Parameters["MyVar"];
RegistryKey key = Registry.LocalMachine;
using (key = key.CreateSubKey(@"SOFTWARE\MyCompany\MyApp")) {
key.SetValue("MyVar", myvar);
key.Close();
}
}