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

sir*_*ank 3 windows-installer wix merge-module wix3.7

我在自己的guid中使用自动guids,<Product>但无法弄清楚如何使用它们<Module>.我只收到这个错误:

组件X有一个密钥文件,路径为'TARGETDIR\company ...'.由于此路径未植根于其中一个标准目录(如ProgramFiles文件夹),因此该组件不符合自动生成guid的条件.

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

唯一的问题是这不是真的.我的目录根植于ProgramFiles,就像我的产品一样,我的产品工作正常:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFiles64Folder">
        <Directory Id="MODULEINSTALLLOCATION" Name="!(loc.ProductManufacturerFolderName)">
            <Directory Id="Data" Name="Data">
Run Code Online (Sandbox Code Playgroud)

我的所有组件声明看起来大致如下:

<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>
Run Code Online (Sandbox Code Playgroud)

打破它很容易,你只需要更改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>
Run Code Online (Sandbox Code Playgroud)

我有一个.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>
Run Code Online (Sandbox Code Playgroud)

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

问题是什么?

Sta*_*ker 6

我自己也有这个类似的问题,根据你的错误信息,它可能是相同的.尝试添加一个ComponentGuidGenerationSeed,它可以解决您的问题.ComponentGuidGenerationSeed也适用于所有子文件夹,因此顶级的单个子文件夹对所有文件夹都足够.

例:

<Directory Id="DOCUMENTATIONFOLDER" Name="Documentation" ComponentGuidGenerationSeed="a9f690d3-22b3-488f-bdac-bb665c25933c"/>
Run Code Online (Sandbox Code Playgroud)

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

组件指南生成种子是一个guid,当具有生成guid指令("*")的组件未植根于标准Windows Installer目录(例如,ProgramFilesFolder或CommonFilesFolder)时,必须使用该指南.