I went through "Setup Events"
So basically what my understanding is.
static void project_Load(SetupEventArgs e)
{
var msi = e.MsiFile;
SetEnvVersion(e.Session);
//MSI doesn't preserve any e.Session properties if they are accessed from deferred actions (e.g. project_AfterInstall)
//Wix# forces some of the properties to be persisted (via CustomActionData) by using user defined
//project.DefaultDeferredProperties ("INSTALLDIR,UILevel" by default).
//Alternatively you can save any data to the Wix# specific fully persisted data properties "bag" SetupEventArgs.Data.
//SetupEventArgs.Data values can be set and accesses at any time from any custom action including deferred one.
var conn = @"Data Source=.\SQLEXPRESS;Initial Catalog=RequestManagement;Integrated Security=SSPI";
__e.Data["persisted_data"]__ = conn;
MessageBox.Show(e.ToString(), "Load " + e.Session["EnvVersion"]);
}
static void project_AfterInstall(SetupEventArgs e)
{
MessageBox.Show(e.ToString() +
"\npersisted_data = " + __e.Data["persisted_data"]__ +
"\nADDLOCAL = " + e.Session.Property("ADDLOCAL"),
caption: "AfterExecute ");
try
{
System.IO.File.WriteAllText(@"C:\Program Files (x86)\My Company\My Product\Docs\readme.txt", "test");
}
catch { }
}
Now here conn string is hardcoded, i am still not getting how to set it from my custom CLR dialog it's a win form combobox also at what event it should be set to session?So basically what my understanding is.
private void Next_Click(object sender, EventArgs e)
{
//session["AppVersion"] = comboBox1.Text; // value needs to be set here 'somehow'
MSINext();
}