我可以将自动生成的 GUIDS 与合并模块一起使用吗?

Can I use auto-generated GUIDS with a merge module?

我在 <Product> 中使用了自动引导,但不知道如何将它们与 <Module> 一起使用。我只得到这个错误:

The component X has a key file with path 'TARGETDIR\company...'. Since this path is not rooted in one of the standard directories (like ProgramFiles Folder), the component does not meet the criteria for having an automatically generated guid.

上面,company是映射到!(loc.ProductManufacturerFolderName)的值。

唯一的问题是事实并非如此。我的目录就像我的产品一样植根于 ProgramFiles,并且我的产品工作正常:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFiles64Folder">
        <Directory Id="MODULEINSTALLLOCATION" Name="!(loc.ProductManufacturerFolderName)">
            <Directory Id="Data" Name="Data">

我所有的组件声明大致如下所示:

<Component Id="DocumentationParty_Business_TestCases_v1xlsx.component" Guid="{YOURGUID-1234-1234-84B3-C595A63428AD}" MultiInstance="yes">
    <File Source="../../Development/Integration/SSIS/Documentation/Party_Business_Test Cases_v1.xlsx" KeyPath="yes" Id="DocumentationParty_Business_TestCases_v1xlsx.file" />
</Component>

破解很简单,只需要将GUID改成*就会出现上面的错误结果。这是坏的:

<Component Id="DocumentationParty_Business_TestCases_v1xlsx.component" Guid="*" MultiInstance="yes">
    <File Source="../../Development/ClaimsIntegration/SSIS/Documentation/Party_Business_Test Cases_v1.xlsx" KeyPath="yes" Id="DocumentationParty_Business_TestCases_v1xlsx.file" />
</Component>

我有一个 .wxs 文件用于每个要安装组件的目录。我所有的组件持有 .wxs 文件都具有以下结构:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Fragment>
    <ComponentGroup Id="DatabasePolicy_Files">
      <ComponentRef Id="DatabasePolicyCreateDatabasecmdtemplate.component" />
    </ComponentGroup>
    <DirectoryRef Id="DataPolicy">
      <Component Id="DatabasePolicyCreateDatabasecmdtemplate.component" Guid="*" MultiInstance="yes">
        <File Source="../../Development/Database/Policy/CreateDatabase.cmd.template" KeyPath="yes" Id="DatabasePolicyCreateDatabasecmdtemplate.file" />
      </Component>
    </DirectoryRef>
  </Fragment>
</Wix>

每个 <ComponentGroup> 都通过 <ComponentGroupRef> 包含在我的主 .wxs 文件中。这适用于我所有的 MSI 项目,并且只有在我开始使用合并模块后才会中断。此外,我已经尝试注释掉所有组件,除了符合上述定义的组件,它仍然会因相同的错误而中断。

有什么问题?

我自己也遇到过类似的问题,根据您的错误消息,它可能是一样的。 尝试添加一个 ComponentGuidGenerationSeed,这应该可以解决您的问题。 ComponentGuidGenerationSeed 也作用于所有子文件夹,因此 top-level 中的一个就足以用于所有文件夹。

示例:

<Directory Id="DOCUMENTATIONFOLDER" Name="Documentation" ComponentGuidGenerationSeed="a9f690d3-22b3-488f-bdac-bb665c25933c"/>

http://wixtoolset.org/documentation/manual/v3/xsd/wix/directory.html

The Component Guid Generation Seed is a guid that must be used when a Component with the generate guid directive ("*") is not rooted in a standard Windows Installer directory (for example, ProgramFilesFolder or CommonFilesFolder).