如何将 Wixtool 集与 Github 操作集成?

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

我使用 wixtoolset 为我的软件构建版本。我想通过 GITHUB 操作自动化发布构建过程。此外,我能够弄清楚大部分事情,但我被 Visual Studio 中的一件事困住了。我已经为 WIX 使用的文件属性定义了预处理器变量。 当我通过 GitHub 操作构建应用程序时。我收到错误为

error CNDL0150: Undefined preprocessor variable '$(var.i2vPatchApplier.TargetPath)'. 

这是我的 yml 文件

name: Build

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: [windows-latest]

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Setup MSBuild
        uses: microsoft/setup-msbuild@v1
      
      - name: Set path for candle and light
        run: echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" >> $GITHUB_PATH
        shell: bash
        
      - name: Restore dependencies
        run: nuget restore i2V_Patch_Applier.sln

      - name: Build application
        run: msbuild i2vPatchApplier/i2vPatchApplier.csproj
      
      - name: Build WiX Project
        run: msbuild PatchApplierSetup/PatchApplierSetup.wixproj

我的工作流程在 Build Wix 项目上失败。下面是Product.wxs文件的代码片段

<Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
             <Component Id="ProductComponent"  Guid="c32e5a53a42f454d9733756c1d7d3027">
                 <File Id="PatchApplier" Name="i2V Patch Applier.exe" Source="$(var.i2vPatchApplier.TargetPath)"></File>
             </Component> 
        </ComponentGroup>
    </Fragment>

我想知道如何直接传递Source中exe的路径。这是作业构建项目将生成的 exe。

wix github-actions
1个回答
0
投票

对于 WiX v>=4,它是通过

dotnet
安装的,可以通过包含
Microsoft/MSBuild
将其添加到您的 GitHub 操作中。以下是要包括的必要步骤:

steps:
  ...
  - name: Add msbuild to PATH
    uses: microsoft/[email protected]
  - name: Install WiX
    run: dotnet tool install --global wix
  - name: Build WiX on Windows
    run: wix build .\nexus.wxs
© www.soinside.com 2019 - 2024. All rights reserved.