Plan msi features #2
-
Could you please tell me in which place in the code it is possible to handle the setting of specific features. I want to put the installation of shortcuts for the application in the UI, however, I couldn't find a place where features are scheduled before installation. As I understand it is the OnPlanMsiFeature event, however, I don't reach this function when debugging during installation. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
When authoring an install package, I don't rely on the bundle to provide any of the installation logic. I use it for defining the bundle chain, gathering data from the user, and passing that data to the packages. However, I'm often authoring the packages, so I have the freedom to decide how to handle this stuff. For example, in the case of an app shortcut, I'd define a bundle variable in bundle.wxs,
Then add a property to ConfigViewModel that can be bound to a checkbox,
Finally, I'd pass the value of the bundle variable to a package property, then condition the feature or shortcuts based on that MSI property within my package.
This allows me to keep the logic of installing shortcuts neatly within my packages without having that bleed into my bundle, except for the data gathering. If you didn't author the package, you can try looking at it with Orca to see if the features are conditioned by any properties that you can take advantage of. As for why the event isn't firing, that's up to the Windows Installer service. Perhaps the service conditions the raising of this event. In my experience, this is the most likely reason you may not be seeing it, but only the devs at Microsoft would know. It's also possible there's a bug in WiX such that the event isn't bubbling correctly. It's my understanding that the WiX bundle exploits some of the events raised by Windows Installer. Others appear to be required by Windows, like the start and completion of each phase. For example, it seems intentional that your bundle has to start the apply phase after the plan phase completes. But for other events, I suspect WiX bundles are exploiting functionality that Windows has its own uses for. Sometimes Windows doesn't always raise events as you'd expect. As a whole, these events are raised frequently enough to rely on them for progress reporting and cancellation, but at the bundle level, they may not be good for much more. |
Beta Was this translation helpful? Give feedback.
As I mentioned, I'm not the best to ask about this stuff because I haven't taken this kind of approach in a very long time. If you're trying to condition multiple components, it sounds like you were on the right track originally. You prompted me to get off my lazy rear and start looking into this, though. Here's what I've come up with.
Conditions can only be used in a Fragment in a bundle, not a package. That's why the Fragment's child Condition is in the bal schema, not the main schema. This makes sense, because WiX still has to play by rules defined by the MSI database structure, which only supports conditions for specific tables.
As you know, Features are intended to be installed or un…