命令
heat.exe dir "./YouDIR" -cg ALLCOMP -dr INSTALLFOLDER -gg -g1 -sf -srd -var "var.SDir" -out "file.wxs"
结果
<?xml version="1.0" encoding="utf-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Fragment> <DirectoryRef Id="INSTALLFOLDER"> <Directory Id="dir2479B4CBD34C5D8E06045ABE7EF6401E" Name="db" /> </DirectoryRef> </Fragment> <Fragment> <ComponentGroup Id="ALLCOMP"> <Component Id="cmp9010E8C10C45E31A5CDBF0425FD67167" Directory="INSTALLFOLDER" Guid="1B0E9DE1-A275-4182-A1DC-7DA359192167"> <File Id="filF9EC2E62E42C120B93749F481CC25465" KeyPath="yes" Source="$(var.SDir)\test.txt" /> </Component> <Component Id="cmpD94AD5D83CD886B753497C0D790A8FCA" Directory="dir2479B4CBD34C5D8E06045ABE7EF6401E" Guid="2F8FAE3E-6686-4BF3-8302-D642C363AC2D"> <File Id="fil2F852BF0C8E3D6463993D1B200801A35" KeyPath="yes" Source="$(var.SDir)\db\test.txt" /> </Component> </ComponentGroup> </Fragment> </Wix>
在Product中的Feature中引用
<Feature Id="MainFeature" Title="Main" Level="1"> <ComponentGroupRef Id="ALLCOMP"/> </Feature> </Product>