Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual Symbols #7913

Closed
robmen opened this issue Dec 12, 2023 · 0 comments · Fixed by wixtoolset/wix#475
Closed

Virtual Symbols #7913

robmen opened this issue Dec 12, 2023 · 0 comments · Fixed by wixtoolset/wix#475
Assignees
Labels
wip WiX Improvement Proposal

Comments

@robmen
Copy link
Member

robmen commented Dec 12, 2023

User story

  • As a setup developer, I can make any symbol "overridable", not just specific symbol types like actions, bind variables and directories.
  • As a WiX Developer, I can create the WiX Standard Library without adding additional special case overrides.

Proposal

The WiX toolset supports "overriding" a few symbol types to support some common but narrow scenarios. For example, WixAction symbols can be defined Overridable, which allows the standard Windows Installer actions to be statically defined in the WiX code but still allows setup developers to customize the sequence or condition of a standard action. Similarly, WixVariable can be defined Overridable to allow late bind time customization of libraries. Finally, the linker and Windows Installer backend have special handling to include the standard directories when needed.

With the exploration of more default symbols (such as default MajorUpgrade and default Feature) it is clear that the concept of allowing a symbol to be "overridden" is generally useful.

To support overridable generically, we'll borrow the concept of virtual methods from object-oriented programming languages and add a new virtual and override access modifiers to WiX. Symbols with identifiers marked virtual are considered global and can be optionally overridden by a single symbol with an identifier marked override. It is a linker error if the same identifier is found to be virtual by more than one symbol or override by more than one symbol.

The following is a trivial example where a Property symbol is defined and overridden in the same section. This is not practically useful.

<Fragment>
  <Property Id="virtual MyProp" Value="This value will not be used if MyProp is overridden." />
  <Property Id="override MyProp" Value="This value will be in the build output." />
</Fragment>

Considerations

  • Virtual symbols are an advanced feature that requires sections to be carefully organized to prevent undesirable side effects. Thus, it is recommended that virtual symbols are generally placed in very small sections with no other global symbols.

  • In WiX v5, virtual symbols will be allowed anywhere but we may need to limit their applicablity in future releases. For example, virtual Component symbols could easily create Component Rule violations but it is not clear that virtual makes this any more likely than cut-n-paste does already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wip WiX Improvement Proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants