在WIX 3.9中分配文件安装文件夹时出错

时间:2015-06-17 08:44:48

标签: directory wix windows-installer

我正在为安装程序设置安装位置。但是,当我尝试设置位置时,它会引发错误。源代码:

    <?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="Wix_setup" Language="1033" Version="1.0.0.0" Manufacturer="Frank Jansen" UpgradeCode="37a42e55-dea8-47da-8f4f-fb065dd38a9e">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate EmbedCab="yes"/>

    <Feature Id="ProductFeature" Title="Wix_setup" Level="1">
      <!--create a seperate ComponentGroupRef and Fragment for each extra added program-->
      <ComponentGroupRef Id="InstallationFiles" />
      <ComponentGroupRef Id="DLLs" />
      <ComponentGroupRef Id="IniFiles" />
      <ComponentGroupRef Id="Scripts" />
      <ComponentGroupRef Id="TeamViewer" />
      <ComponentGroupRef Id="Wix_database" />
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="Wix_setup" />
      </Directory>
    </Directory>
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" ></Property>
    <UIRef Id="WixUI_InstallDir"/>
  </Fragment>

  <Fragment>

    <ComponentGroup Id="DLLs" Directory="INSTALLFOLDER">

      <Component Id="cmp0F2CCC19DBBB1A659BB614D21AAFB413" Guid="{1B34DA48-A891-4923-8437-8116FB986A4E}">
        <File Id="filFD63715191DEBF4B34A2836B7D53C62B" KeyPath="yes" Source="C:\Users\fjansen\Documents\MMI installatie bestanden\MMI install files\Program Files\ActiveX Control Pad\ScrWiz.dll" />
      </Component>

    </ComponentGroup>

      <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder" />
      </Directory>

  </Fragment>

我在此示例中尝试执行的操作是将文件放在程序文件文件夹中。但是当我构建解决方案时,它会抛出以下错误:

Error   3   Duplicate symbol 'Directory:ProgramFilesFolder' found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique.

Error   1   Duplicate symbol 'Directory:TARGETDIR' found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique.

我不明白为什么会收到这些错误。我需要将多个打击垫定义到多个位置,这些打击垫的某些部分与其他打击垫相同,这意味着,例如,我需要多次使用ProgramFilesFolder来处理不同的文件。但是,当我这样做时,我发现了一个错误。

我做错了什么?

2 个答案:

答案 0 :(得分:0)

您无法重复目录的ID。 请尝试以下代码:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="Wix_setup" Language="1033" Version="1.0.0.0" Manufacturer="Frank Jansen" UpgradeCode="37a42e55-dea8-47da-8f4f-fb065dd38a9e">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate EmbedCab="yes"/>

    <Feature Id="ProductFeature" Title="Wix_setup" Level="1">
      <!--create a seperate ComponentGroupRef and Fragment for each extra added program-->
      <ComponentGroupRef Id="InstallationFiles" />
      <ComponentGroupRef Id="DLLs" />
      <ComponentGroupRef Id="IniFiles" />
      <ComponentGroupRef Id="Scripts" />
      <ComponentGroupRef Id="TeamViewer" />
      <ComponentGroupRef Id="Wix_database" />
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="Wix_setup" />
      </Directory>
    </Directory>
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" ></Property>
    <UIRef Id="WixUI_InstallDir"/>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="DLLs" Directory="INSTALLFOLDER">
      <Component Id="cmp0F2CCC19DBBB1A659BB614D21AAFB413" Guid="{PUT-GUID-HERE}">
        <File Id="filFD63715191DEBF4B34A2836B7D53C62B" KeyPath="yes" Source="C:\Users\fjansen\Documents\MMI installatie bestanden\MMI install files\Program Files\ActiveX Control Pad\ScrWiz.dll" />
      </Component>
    </ComponentGroup>      
  </Fragment>
</Wix>

答案 1 :(得分:0)

这种结构应该对你有帮助。 引用CommonFilesFolder的id

model_1 = models.ForeignKey(Model1, null=True, blank=True, default = None)

此链接可能会在将来帮助您

https://msdn.microsoft.com/en-us/library/s2esdf4x%28VS.80%29.aspx