Simplifying the WiX v3 language

WiXv3引入了简化WiX语言的两项改进,旨在使设置作者工作更简单并减少冗余。组件特征属性简化了组件与特征之间的关联,而文件元素ID默认值从源文件名获取,简化了文件元素的编写。这些更改旨在提高代码清晰度和减少手动输入。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Simplifying the WiX v3 language

Two recent changes that simplify the WIX language are available in the WIX v3. The goal of both changes is to make simple setup authoring simpler and help reduce redundancy.

Assigning components to features via attribute

The Component element now has a Feature attribute; when set, that component is parented to the specified feature. So the following snippets are equivalent:

<Component Id=”FooComp” Feature=”BarFeature” … />

and

<Component Id=”FooComp” … />

<FeatureRef Id=”BarFeature”>
<ComponentRef Id=”FooComp” />
</FeatureRef>

Component/@Feature supports one feature reference. You can still parent one component to multiple features using Feature or FeatureRef and ComponentRef. This change is to simplify the more common case of one component parented to one feature.

Default File Id and Name from Source

Typical File element authoring has several attributes with similar values. A File’s Id, Name, and Source elements might all mention the same file name, for example. WiX v3 already has several defaults that simplify File element authoring, like defaulting the Name attribute value to that of the Id attribute.

The File element now takes the default for the Id attribute from the file name portion of the Source attribute. The Name attribute then gets its default value from Id, so authoring a File element can now be as simple as:

<File Source=”$(env.Bits)/foo/bar/baz.exe” />

The equivalent would be:

<File Id=”baz.exe” Name=”baz.exe” Source=”$(env.Bits)/foo/bar/baz.exe” />

Simple change, simple benefit

A simpler language makes it easier for designers to generate clean code and for those who prefer hand authoring to minimize unnecessary typing.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值