I had serious problems with how to solve this problem: I do not know where the OnAfterInstall event is going.
Let me explain. I created a C # project that compiles fine and is built in Release mode. After that, I created the installation project using the wizard. I added an additional dialog that allows the user to choose between two languages. Now my problem is that I want to save this language in the registry (or the app.config file is all the easier), and I read that you need to find it in the OnAfterInstall method in the inherited Installer class.
Now where should I put this class? Logic tells me that it goes in a C # project, but it complains that neither the Context class nor the Installer exists. When I add this class to the installation project, it does not complain, but after that it does not work. Here is the class.
using System; using System.Configuration.Install; public class Install : Installer { public Install() { } protected override void OnAfterInstall(IDictionary savedState) { string lang = Context.Parameters["lang"]; RegistryKey key = Registry.LocalMachine; using (key = key.CreateSubKey(@"SOFTWARE\MyCompany\MyApp")) { key.SetValue("lang", lang); key.Close(); } base.OnAfterInstall(savedState); } }
PS: I already pass lang
as CustomActionData using / lang = [LANG] (where LANG is the radio value)
source share