Wix XML错误-当Component元素嵌套在Directory元素下时,无法指定Component/@Direct



第一次做Wix练习,所以我对它完全陌生。

这是我的短篇:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="SampleMSI" Language="1033" Version="1.0.0.0" Manufacturer="Nunya" UpgradeCode="b2c39f9b-1de1-433e-bc59-a3548cc531b9">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Description="Installs Signout Utility" Keywords="Practice,Signout,Utility,MSI,Installer" />
        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />
        <Feature Id="ProductFeature" Title="SampleMSI" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>
    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="SampleMSI" />
         <Directory Id="APPFOLDER" Name="APPDir" >
         </Directory>
            </Directory>
        </Directory>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component Id="CMP_ADispOCX"
              Guid="5E23B839-35CA-480E-8AFC-2E914BA8E32A"
              Directory="INSTALLLOCATION">
      <File Id="FILE_ADispocx"
              Source="ADisp.ocx"
              KeyPath="yes" />
        </Component>
     <Component Id="CMP_Abtn32ocx"
              Guid="98B357F2-C295-4019-A878-885E56AA3BF3"
              Directory="INSTALLLOCATION">
      <File Id="FILE_Abtn32a20ocx"
              Source="btn32a20.ocx"
              KeyPath="yes" />
        </Component>
   </ComponentGroup>
    </Fragment>
</Wix> 

我只是想确保他们去同一个文件夹,基本的安装检查。(这是我第一次)

但是,我得到了以下错误:错误2当Component元素嵌套在Directory元素下面时,不能指定Component/@Directory属性。

每个组件id我都会得到两次。

我是不是错过了什么?我使用Wix3.6A开发者指南作为参考。

编辑:附带问题。。。。。。如何指定确切的路径?类似C:\Herp\Dep

如果您已经在ComponentGroup元素中指定了Component的目录,则不需要指定该目录。删除片段中两个Components元素中的Directory属性。

将您的代码更改为此

    <Fragment>
            <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
          <Component Id="CMP_ADispOCX"
                  Guid="5E23B839-35CA-480E-8AFC-2E914BA8E32A">
          <File Id="FILE_ADispocx"
                  Source="ADisp.ocx"
                  KeyPath="yes" />
            </Component>
         <Component Id="CMP_Abtn32ocx"
                  Guid="98B357F2-C295-4019-A878-885E56AA3BF3">
          <File Id="FILE_Abtn32a20ocx"
                  Source="btn32a20.ocx"
                  KeyPath="yes" />
            </Component>
       </ComponentGroup>
</Fragment>

最新更新