oleg-shilo/wixsharp

I would like to set a features directory path by the user in wix# ManagedUI

dorlep opened this issue · 3 comments

Hi,

I would like to set a features directory path by the user using browse button .
I have set ConfigurableDir in Feature and I am using ManagedUI as I don't want Licencing Dialog, but not working for me.
My code is as below, could you please help me

Feature f1 = new Feature("PWindows", "PJW", "INSTALLDIR");
Feature f2 = new Feature("PWeb", "PWebApi", "INSTALLDIR");
Feature f3 = new Feature("IWeb", "ITomcat", "INSTALLDIR");

        var project = new ManagedProject(productName,
               new InstallDir(installDir,
                  new Dir("PJW",
                      new Files(f1, @"Mypath\bin\*.exe"),
                      new Files(f1, @"Mypath\bin\*.dll"),
                      new Files(f1, @"Mypath\*.config"),
                      new Files(f1, @"Mypath\bin\*.xml"))
                 
                  ),
                new RegValue(f1, WixSharp.RegistryHive.LocalMachine, "Software\\PCC\\My Product", "PWindows", "Hello"),
                new RegValue(f2, WixSharp.RegistryHive.LocalMachine, "Software\\PCC\\My Product", "PWeb", 777),
                new RegValue(f3, WixSharp.RegistryHive.LocalMachine, "Software\\PCC\\My Product", "IWeb", 779)

)

        project.SourceBaseDir = sourceDir;
        project.GUID = new Guid("6fe30b47-2577-43ad-9095-1861ba25889b");
        project.ManagedUI = ManagedUI.Empty;    //no standard UI dialogs
        project.ManagedUI = ManagedUI.Default;  //all standard UI dialogs
                                                //custom set of standard UI dialogs
        project.ManagedUI = new ManagedUI();

        
        project.ManagedUI.InstallDialogs.Add<WelcomeDialog>()
                                      // .Add<LicenceDialog>()
                                       .Add<FeaturesDialog>()
                                       .Add<ProgressDialog>()
                                       .Add<ExitDialog>();
        //project.ManagedUI.InstallDialogs.Add(Dialogs.Welcome)
        //                                .Add(FeaturesDialog)
        //                                .Add(Dialogs.Progress)
        //                                .Add(Dialogs.Exit);


        //project.ManagedUI.ModifyDialogs.Add(Dialogs.MaintenanceType)
        //                               .Add(Dialogs.Features)
        //                               .Add(Dialogs.Progress)
        //                               .Add(Dialogs.Exit);

        project.Load += Msi_Load;
        project.BeforeInstall += Msi_BeforeInstall;
        project.AfterInstall += Msi_AfterInstall;

        ValidateAssemblyCompatibility();

        project.BuildMsi();

please help me, Thank you in advance.

You will need to check that the generated WXS file contains the correct Dir Ids. In my test, it does:

image

Though I do not know if the WiX feature ConfigurableDir works as expected.

yes, generated correct Dir ids
image

But still I can't see browse button on Feature dialog box.
If I change UI as below then it is working
project.UI = WUI.WixUI_FeatureTree;

But my problem is I don't want Licencing Dialog box.
so any chance I exclude Licencing Dialog box from WUI.WixUI_FeatureTree;

OK, I see.
WUI.WixUI_FeatureTree is a native MSI Dialog sequence.
new ManagedUI() is a custom WixSharp sequence.
I misread you sample and assumed you worked with the native dialogs

The problem is that the WixSharp.FeatureDialog does not implement the select dir button for the feature item. The feature directory selection is not the most natural/expected behavior so I limited the UX by excluding this button from the implementation. I know, it's bad news for you since you need it.

Anyway, if you created your project from the WixSharp VS template then you have the source code for all dialogs and you can add the button by yourself.

If you are happy with your implementation you can share it with me and I include it to WixSharp.FeaturesDialog.