开发者

Setting a registry value based on dialog in a visual studio setup project

开发者 https://www.devze.com 2022-12-26 02:45 出处:网络
I have visual studio setup project with a custom R开发者_C百科adioButtons dialog. How do I get it to write the value of the ButtonProperty in the registry after it is selected in the UI? If using a

I have visual studio setup project with a custom R开发者_C百科adioButtons dialog.

How do I get it to write the value of the ButtonProperty in the registry after it is selected in the UI?


If using a .Net Installer class do the following:

  1. Pipe the data through to your Custom Action using CustomActionData eg: If your property is called MYPROP: /MyVar=[MYPROP]

  2. 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();
            }
    }
    
0

精彩评论

暂无评论...
验证码 换一张
取 消