Redesign RemotePayload
Design goals
Remove the magic of a chain package's primary payload being the first payload if neither
SourceFile
norRemotePayload
are specified. This brings these elements in line withBootstrapperApplication
, where we already removed this functionality.RemotePayload
is currently only valid forExePackage
andMsuPackage
, but the functionality has been requested forMsiPackage
andPayload
. There are different fields required for each of these scenarios (and will be different for the currently unimplementedBundlePackage
).RemotePayload
needs to be implemented differently so that the other scenarios are possible without overloading it with tons of attributes.
Proposal
Add
ExePackagePayload
,MsiPackagePayload
,MspPackagePayload
, andMsuPackagePayload
elements.The new payload elements can be specified as a child of their parent element, or a
PayloadGroup
.The
SourceFile
attribute on a package element and the new payload element can't both be specified for the same package, but one of them must be specified. TheName
,Compressed
, andDownloadUrl
attributes on the package element can only be specified with theSourceFile
attribute on the package element.If an
MsiPackage
references aPayloadGroup
with anMsuPackagePayload
element, that's an error (and similarly for the other elements).Remove the
RemotePayload
element and move all the attributes onto theExePackagePayload
andMsuPackagePayload
elements. This makes it straightforward to implement the same functionality for other payload elements, just add attributes (or maybe child elements) for the information that the binder harvests.
wix.xsd:
<xs:element name="ExePackagePayload">
<xs:annotation>
<xs:documentation>
Describes information about the ExePackage payload.
Cannot be specified if the owning ExePackage specified the SourceFile attribute.
</xs:documentation>
<xs:appinfo>
<xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="ExePackage" />
<xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="PayloadGroup" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:attributeGroup ref="ChainPackagePayloadCommonAttributes" />
<xs:attributeGroup ref="ExePackageRemoteCommonAttributes" />
</xs:complexType>
</xs:element>
<xs:element name="MsiPackagePayload">
<xs:annotation>
<xs:documentation>
Describes information about the MsiPackage payload.
Cannot be specified if the owning MsiPackage specified the SourceFile attribute.
</xs:documentation>
<xs:appinfo>
<xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="MsiPackage" />
<xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="PayloadGroup" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:attributeGroup ref="ChainPackagePayloadCommonAttributes" />
<xs:attribute name="SourceFile" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>
Location of the package to add to the bundle.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="MsuPackage">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="Payload" />
<xs:element ref="PayloadGroupRef" />
<xs:element ref="MsuPackagePayload" minOccurs="0" maxOccurs="1" />
<xs:any namespace="##other" processContents="lax" />
</xs:choice>
<xs:attributeGroup ref="ChainPackageCommonAttributes" />
<xs:attribute name="DetectCondition" type="xs:string" />
<xs:attribute name="KB" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:attributeGroup name="ChainPackagePayloadCommonAttributes">
<xs:attribute name="Id" type="xs:string">
<xs:annotation>
<xs:documentation>The identifier of the package payload element.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Name" type="xs:string">
<xs:annotation>
<xs:documentation>
The destination path and file name for this chain payload. Use this attribute to rename the
chain entry point or extract it into a subfolder. The default value is the file name from the
SourceFile attribute. This must be a relative path ('\foo' or 'C:\foo' is not allowed).
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DownloadUrl" type="xs:string">
<xs:annotation>
<xs:documentation>
<html:p>The URL to use to download the package. The following substitutions are supported:</html:p>
<html:ul>
<html:li>{0} is replaced by the package Id.</html:li>
<html:li>{1} is replaced by the payload Id.</html:li>
<html:li>{2} is replaced by the payload file name.</html:li>
</html:ul>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Compressed" type="YesNoDefaultTypeUnion">
<xs:annotation>
<xs:documentation>Whether the package payload should be embedded in a container or left as an external payload.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:attributeGroup>
<xs:attributeGroup name="ExePackageRemoteCommonAttributes">
<xs:attribute name="Description" type="xs:string">
<xs:annotation>
<xs:documentation>
Description of the file from version resources.
Required if SourceFile is not specified, otherwise must not be specified.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Hash" type="HexType">
<xs:annotation>
<xs:documentation>
SHA-1 hash of the RemotePayload.
Required if SourceFile is not specified, otherwise must not be specified.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ProductName" type="xs:string">
<xs:annotation>
<xs:documentation>
Product name of the file from version resouces.
Required if SourceFile is not specified, otherwise must not be specified.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SourceFile" type="xs:string">
<xs:annotation>
<xs:documentation>
Location of the package to add to the bundle.
If not specified, the DownloadUrl attribute must be specified.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Size" type="xs:integer">
<xs:annotation>
<xs:documentation>
Size of the remote file in bytes.
Required if SourceFile is not specified, otherwise must not be specified.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Version" type="VersionType">
<xs:annotation>
<xs:documentation>
Version of the remote file.
Required if SourceFile is not specified, otherwise must not be specified.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:attributeGroup>
Examples
- RemotePayload renamed.
Before:
<ExePackage>
<RemotePayload DownloadUrl="example.com" Hash="..." ... />
</ExePackage>
After:
<ExePackage>
<ExePackagePayload DownloadUrl="example.com" Hash="..." ... />
</ExePackage>
- No more magic package payload.
Before, this was valid but would be an error now:
<MsiPackage Id="ABC">
<PayloadGroupRef Id="A" />
</MsiPackage>
<PayloadGroup Id="A">
<Payload SourceFile="abc.msi" DownloadUrl="example.com" />
</PayloadGroup>
After:
<MsiPackage Id="ABC">
<PayloadGroupRef Id="A" />
</MsiPackage>
<PayloadGroup Id="A">
<MsiPackagePayload SourceFile="abc.msi" DownloadUrl="example.com" />
</PayloadGroup>
- All payload information must be on the same element.
This is an error:
<ExePackage DownloadUrl="example.com">
<ExePackagePayload Hash="..." />
</ExePackage>
- The new elements are not required.
This is still valid:
<ExePackage SourceFile="abc.exe" DownloadUrl="example.com" Permanent="yes" />
- There is no difference between using the new element or specifying it on the package element.
These are equivalent:
<MsiPackage SourceFile="abc.exe" DownloadUrl="example.com">
<Payload SourceFile="supporting.file" />
</MsiPackage>
<MsiPackage>
<MsiPackagePayload SourceFile="abc.exe" DownloadUrl="example.com" />
<Payload SourceFile="supporting.file" />
</MsiPackage>
Considerations
The original proposal removed the payload attributes from the package elements (e.g. SourceFile
, Name
, Compressed
, DownloadUrl
from MsiPackage
) to remove confusion from having multiple ways to specify the payload information.
Also, it's not clear at all that these attributes apply only to the magic payload created behind the scenes and not any child payloads.
This was deemed to be too verbose, so a modified proposal kept only SourceFile
.
This was also deemed to be too verbose, so a compromise was to also keep DownloadUrl
.
At that point, the breakage wasn't worth it especially since DownloadUrl
is one of the confusing attributes that doesn't apply to other payloads in the package.
Alternate Proposal
Decline #4183, and require either
SourceFile
or a childRemotePayload
element for chain packages (which removes the ability to implicitly use the first payload as the package payload).Rename the
RemotePayload
element toRemoteExePayload
andRemoteMsuPayload
. Then future payload elements would create their own remote payload element, which would be a child of the original element.