使用多个 .wxs 文件在 GitHub 工作流程中创建 .msi(WiX 工具集)

问题描述 投票:0回答:1

我想在 GitHub Action 中使用 WiX 工具集创建 .msi 文件。由于我使用“heat”命令生成 .wxs 文件 (

Components.wxs
),因此我有两个文件(
Components.wxs
Product.wxs
)需要在编译期间使用。不幸的是,对
Components.wxs
文件的引用不起作用。

Components.wxs 文件看起来更友善:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="PATH">
            <Component Id="SOMEDLL.dll" Guid="*">
                <File Id="SOMEDLL.dll" KeyPath="yes"
                      Source="SourceDir\SOMEPATH" />
            </Component>
        </DirectoryRef>
    </Fragment>
<Fragment>
    <ComponentGroup Id="Components">
            <ComponentRef Id="SOMEDLL.dll" />
    </ComponentGroup>
</Fragment>

最初,我尝试直接使用

ComponentGroupRef
以及
Components.wxs
中我的产品标签内的
Product.wxs
文件中的相应 ID。

<Feature Id="ProductFeature" 
     Title="Setup" 
     Level="1">
    <ComponentGroupRef Id="Components" />
</Feature>

但是,这始终导致错误

Product.wxs(21) : error LGHT0094 : Unresolved reference to symbol 'WixComponentGroup:Components' in section 'Product:*'.

随后,我尝试将以下标签添加到Setup.wixproj中的

ItemGroup
部分:
<Compile Include="Components.wxs" />
。然而,这并没有带来任何改变。

现在,我尝试在项目中包含一个

.wxi
文件,该文件包含在
Product.wxs
中并引用
ComponentGroup
文件中的
Components.wxs
。不幸的是,我遇到了一个错误,指出不允许使用
ComponentGroupRef
标签。

包含组件.wxi:

<?xml version="1.0" encoding="utf-8"?>
<Include>
    <ComponentGroupRef Id="Components" />
</Include>

在 Product.wxs 中:

<Feature Id="ProductFeature" 
     Title="Setup" 
     Level="1">
    <ComponentGroupRef Id="Components" />
</Feature>

错误:

IncludeComponents.wxi(3) : error CNDL0005 : The Wix element contains an unexpected child element "ComponentGroupRef".

我不知道为什么这不起作用,一天后,我已经达到了耐心的极限。有人可以告诉我如何在

.wxs
文件中正确引用另一个
Product.wxs
文件吗? 感谢您的帮助。

github wix github-actions windows-installer wix3.11
1个回答
0
投票

问题是 .wixproj 中的这一行似乎找不到此文件:

<Compile Include="Components.wxs" />

您没有提供足够的信息来了解为什么找不到该文件,但是(假设 WiX v3)您的 .wixproj 中需要两个

Compile
项:

<ItemGroup>
  <Compile Include="Products.wxs" />
  <Compile Include="the\correct\path\to\the\Components.wxs" />
</ItemGroup>

您尝试对包含文件 (

.wxi
) 执行的操作让您感到困惑。您不需要也不应该使用包含文件。

© www.soinside.com 2019 - 2024. All rights reserved.