windowsgitlabwixpipelinewix3

Gitlab Pipeline - Use WiX Toolset v3 in Gitlab Pipeline


I need to run WiX Toolset V3.14.1 light command during Gitlab Pipeline, but it's never available to run.

Job configuration

tags:
    - saas-windows-medium-amd64 # to use Windows runner

Job execution

During the job execution, I install WiX using chocolatey choco install -y --ignore-dependencies --no-progress wixtoolset

build_windows:
  tags:
    - saas-windows-medium-amd64 # to use Windows runner
  stage: build
  script:
    - choco install -y --ignore-dependencies --no-progress wixtoolset
    - corepack enable
    - Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
    - light

Even after the installation, light command is not recognized. The message I receive looks like this:

light : The term 'light' is not recognized as the name of a cmdlet, function, script file, or operable program. Check 
the spelling of the name, or if a path was included, verify that the path is correct and try again.

Running in local machine

When I run each of the commands in my local Windows 10 machine, it works perfectly.

Anyone knows what is the problem with WiX Toolset in Gitlab?

Thank you so much.


Solution

  • I fixed that by using the actual path for light installed in the Gitlab runner (C:\Program Files (x86)\Wix Toolset 3.14\bin\light.exe), then creating an alias to the light command

    Job configuration

    My job looked like this at the end

    build_windows:
      tags:
        - saas-windows-medium-amd64 # to use Windows runner
      stage: build
      script:
        - choco install -y --ignore-dependencies --no-progress wixtoolset
        - corepack enable
        - Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
        - Set-Alias light "C:\Program Files (x86)\WiX Toolset v3.14\bin\light.exe"
        - light
    

    And I'm able to use light command!

    Thank you!