簡體   English   中英

wix和heat配置安裝文件夾

[英]wix and heat configure installation folder

我使用WiX,我會在安裝程序中包含文件和另一個文件夾。

其實我有這個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)" />
...

還有兩個.wxs文件(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>

例如,通過熱命令行生成的wixfile2.wxs。 我將部署所有名為“ 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 

但是,當我編譯wixproj時,它可以工作,但是在運行安裝程序后,僅將myimg.png部署在正確的位置,但未部署API。

我能忘記幾件事嗎?

Edit1:現在有了bradfordrg解決方案,我在wixproject編譯時遇到了這個錯誤:

“ C:\\ project.wixproj”(標准電纜)(1)->(鏈接電纜)-> C:\\ wixfile1.wxs(25):錯誤LGHT0094:在“產品”部分中未解析符號'Component:MyAPP'的相關符號:*”。 [C:\\ project.wixproj]

進入wixfile2我有:

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

和wixfile1.wxs我有:

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

很好嗎?

該問題似乎由heat.exe生成的組件未被任何<Feature...>元素引用。

當您運行heat.exe生成wixfile2.wxs ,請使用-cg MyAPI選項在文件中生成一個<ComponentGroup...>元素。 這應該將這種類型的內容添加到wixfile2.wxs

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

然后在wixfile1.wxs聲明的功能中引用新的組件組:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM