Using WiX to package an installer with many files

2019-04-14 23:50发布

问题:

I have a WiX 3 project that has hundreds of files, and I can't seem to figure out how to include them all using a wildcard. I have tried this:

heat.exe" dir ".\!Build" -gg -ke -template:fragment -out "Files.wxs"

This produces a fragment .wxs file, but I'm not sure what to do with it. Any help would be much appreciated.

回答1:

Try this command

heat dir "Your_Directory" -gg -ke -template:Product -out "Files.wxs"

It will create this structure in the generated wxs file {Files.wxs}:

<Fragment>
    <DirectoryRef Id="Files">
        <Component Id="Test.ico" Guid="{YOUR_GUID}">
            <File Id="Test.ico" Name="Test.ico" KeyPath="yes" Source="..[path to file]\Test.ico" />
        </Component>
    </DirectoryRef>
</Fragment>

You should get one for each file, that was in the directory that you ran heat against. Once that is done, you just have to add the wxs file to your project, make sure you have the directory that the directoryref points to is created.