Quantcast
Channel: wixsharp Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1354

New Post: How to install files in a folder based on custom property

$
0
0
Yes you have to read the reg value and set it to the INSTALLDIR property. Doing this you will mimic passing this property value from command line.

Though ManagedProject.Load event is not good because it is called after the UI is initialized. You will need to set this property from ManagedProject.UILoaded event for ManagedUI. And for the native MSI UI it has to be a custom action scheduled before UI loaded:
//Native MSI UIvar project =
    new Project("MySetup",
        new ManagedAction("SetInstallDir",
                            Return.check,
                            When.Before,
                            Step.LaunchConditions,
                            Condition.NOT_Installed,
                            Sequence.InstallUISequence),
...
[CustomAction]
publicstatic ActionResult SetInstallDir(Session session)
{
    session["INSTALLDIR"] = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\7-Zip")
                                                .GetValue("Path")
                                                .ToString(); 
    return ActionResult.Success;
}
//ManagedUIvar project =
    new ManagedProject("MySetup",
...
project.UILoaded += project_UIInit;
...
staticvoid project_UIInit(SetupEventArgs e)
{
    e.Session["INSTALLDIR"] = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\7-Zip")
                                                  .GetValue("Path")
                                                  .ToString();
}
Please note that in older releases ManagedUI had a problem initializing the installdir text box. Thus please use the vary latest release where it's fixed.

Viewing all articles
Browse latest Browse all 1354

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>