What is the meaning of WiX configurable directory?

2019-03-06 04:06发布

问题:

I have a test installer that has 2 features A and B. A has 2 files a1 and a2, B has also 2 files b1 and b2(Each file belongs to individual component).

Feature A = {a1, a2}
Feature B = {b1, b2}

And the installation location for each file is as follows(somewhat mixed):

[ProgramFilesFolder]
    MyApp\
        Dir1\
            a1
            b1
        Dir2\
            a2
            b2

I set feature A's configurable directory to Dir1 and feature B's to Dir2.

When I launch the installer feature tree dialog says feature A's install location is [ProgramFilesFolder]\MyApp\Dir1 and feature B's install location is [ProgramFilesFolder]\MyApp\Dir2, like meaning a1, a2(feature A) are installed into Dir1 and b1, b2(featuer B) into Dir2.

But actual installation result is that a1, b1 are installed into Dir1 and a2, b2 are installed into Dir2. Of course, this is very normal behavior compared to my source code, but I don't get what the configurable diretory means in this situation.

回答1:

This is for the feature selection tree and browse button on a custom setup dialog. You can associate a directory to the feature so that the user can select which directory the feature goes to.

The reality is most applications have all features (if they have more then one in the first place) all use the same configurable directory. ( Say INSTALLLOCATION for WiX, TARGETDIR for VDPROJ or INSTALLDIR for InstallShield ) Even then though components can actually have whatever directory they need for their destination so changing the destination for a feature doesn't actually mean every component in that feature will go to that directory. Some might need to go to places like SystemFolder.

In the more advanced scenarios you might have features broken out into say Windows App, Windows Service, WebUI and you might want to select where each of those go on the machine.

Make sense?



回答2:

For summary:

If I understood correctly, ConfigurableDirectory of a feature only has effect on its components that are installed under that ConfigurableDirectory. That is, a user can only change the target directory of components (of a feature) that are under ConfigurableDirectory.