简体   繁体   中英

wix and heat configure installation folder

I work with WiX and i would include files and another folder to my installer.

Actually I have this project.wixproj :

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 ...
  <ItemGroup>
    <Compile Include="wixfile1.wxs" />
    <Compile Include="wixfile2.wxs" />
  </ItemGroup>
  <Import Project="$(WixTargetsPath)" />
...

And two .wxs files (wixfile1.wxs):

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    ...

        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="WINDOWSVOLUME">
                <Directory Id="test" Name="test" >
                    <Directory Id="APPLICATIONROOTDIRECTORY" Name="Application test"/>
                </Directory>
            </Directory>
        </Directory>


        <DirectoryRef Id="APPLICATIONROOTDIRECTORY">
            <Component Id="myimg.png" Guid="7435781f-2bf1-4f1b-8376-754c2d4dac68">
                <File Id="myimg" Source="C:\imglol.png" KeyPath="yes" Checksum="yes"/>
            </Component>

        </DirectoryRef>


        <Feature Id="myimg" Title="Main image" Level="1">
            <ComponentRef Id="myimg.png" />
        </Feature>
    </Product>
</Wix>

And by example the wixfile2.wxs which are generated by heat command line. I would deploy all folder named "API".

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>


        <DirectoryRef Id="TARGETDIR">
            <Directory Id="dirA4F7A43D3DBF467AC127F1422D00240E" Name="API">
                <Component Id="cmpCCEB1A915DCA242C688E53A21CE3C3CD" Guid="{}">
                    <File Id="fil0507E8B9603778F116316274B82F92D9" KeyPath="yes" Source="SourceDir\Library.Def.xml" />
                </Component>
                <Component Id="cmp4D36C9F3F381088827D9A606380954B9" Guid="{}">
                    <File Id="fil1E594FEBC557E93E0B15FC1DC3DE315F" KeyPath="yes" Source="SourceDir\APPli.CFG" />
                </Component>
                <Component Id="cmpF940CA5BFB57C855744EC0E727B0B13E" Guid="{}">
                    <File Id="fil5488939102DA1D694DFD42512F2BBD77" KeyPath="yes" Source="SourceDir\AppControl.cgf" />
                </Component>
                <Component Id="cmp8FB86D8D349378672E4CCD03AF81F56D" Guid="{}">
                    <File Id="filBF7F9A64772328CD9FBCB2EABD140A91" KeyPath="yes" Source="SourceDir\Application.Configuration.xml" />
                </Component> ........ and others folders and file 

But when i compile my wixproj, it's works but after running the installer just the myimg.png are deployed in the right place but API isn't deployed.

Could i have forgotten few things ?

Edit1: Now with bradfordrg solution i have this error at the wixproject compilation :

"C:\\project.wixproj" (cible par défaut) (1) ->(Link cible) ->C:\\wixfile1.wxs(25): error LGHT0094: Unresolved rference to symbol 'Component:MyAPP' in section 'Product:*'. [C:\\project.wixproj]

Into wixfile2 i have :

<Fragment>
        <ComponentGroup Id="APP">
            <ComponentRef Id="cmpFE6698874FDA6C78569E0859730A1EEA" />
            <ComponentRef Id="cmpB50D6DA51C4E18ACC1DA69264417232D" />
            <ComponentRef Id="cmp1D36D13E7527C1AA7991A8BA6BD00215" />
            <ComponentRef Id="cmpA22778B0611224EC3606522B68E34E2D" />
....

and wixfile1.wxs i have :

<Feature Id="myimg" Title="Main image" Level="1">
            <ComponentRef Id="myimg.png" />
    <ComponentRef Id="APP" />
        </Feature>

It's good no ?

The problem looks like the heat.exe generated components are not being referenced by any <Feature...> element.

When you run heat.exe to generate wixfile2.wxs , use the -cg MyAPI option to generate a <ComponentGroup...> element in the file. This should add this type of content to wixfile2.wxs :

<Fragment>
    <ComponentGroup Id="MyAPP">
        <ComponentRef Id="cmpCCEB1A915DCA242C688E53A21CE3C3CD" />
        <ComponentRef Id="cmp4D36C9F3F381088827D9A606380954B9" />
        ...
    </ComponentGroup>
</Fragment>

Then reference the new component group in the feature declared in wixfile1.wxs :

<Feature Id="myimg" Title="Main image" Level="1">
    <ComponentRef Id="myimg.png" />
    <ComponentGroupRef Id="MyAPP" />
</Feature>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM