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

被折叠的 条评论
为什么被折叠?



