1
votes

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 ?

1
Where you want to deploy the API? TARGETDIR is defaulted to root drive. So Add some other directory under SourceDir in Wix file1 for API and refer that Directory ID in WIX file2. It will work.Vinoth
in the same directory that myimg.png /Myapplication/myimg.png and /My application/API/...Neyoh
In that case you have to add "APPLICATIONROOTDIRECTORY" in DirectoryRef wix file 2.Vinoth
it doesn't work, i always have just myimg.png but no /API/ folder into /My application/Neyoh
At the end of my wixfile2, how specifed the install directory like <feature> block into the wixfile1 ?Neyoh

1 Answers

1
votes

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>