Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiX toolkit is not in the PATH #9551

Closed
2 of 13 tasks
kevgo opened this issue Mar 23, 2024 · 5 comments
Closed
2 of 13 tasks

WiX toolkit is not in the PATH #9551

kevgo opened this issue Mar 23, 2024 · 5 comments
Assignees
Labels
Area: Scripting and command line awaiting-deployment Code complete; awaiting deployment and/or deployment in progress bug report OS: Windows

Comments

@kevgo
Copy link

kevgo commented Mar 23, 2024

Description

WiX provides several binaries in C:\Program Files (x86)\WiX Toolset v3.14\bin. This directory is not in the PATH environment variable.

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • macOS 11
  • macOS 12
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

Image: windows-2022
  Version: 20240317.1.0
  Included Software: https://github.com/actions/runner-images/blob/win22/20240317.1/images/windows/Windows2022-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20240317.1

Is it regression?

no, it was always broken afaik

Expected behavior

C:\Program Files (x86)\WiX Toolset v3.14\bin is in the PATH. I can call executables from the WiX toolkit, like C:\Program Files (x86)\WiX Toolset v3.14\bin\candle.exe from any directory.

Actual behavior

C:\Program Files (x86)\WiX Toolset v3.14\bin is not in the PATH. I can not call executables from the WiX toolkit, like C:\Program Files (x86)\WiX Toolset v3.14\bin\candle.exe from any directory.

Repro steps

To reproduce, I try to call the candle.exe executable provided by WiX:

> candle.exe -?

'candle' is not recognized as an internal or external command,
operable program or batch file.

Checking the PATH environment variable reveals that WiX is indeed not in it:

> $env:PATH

C:\Program Files\MongoDB\Server\5.0\bin;C:\aliyun-cli;C:\vcpkg;C:\Program Files (x86)\NSIS\;C:\tools\zstd;C:\Program Files\Mercurial\;C:\hostedtoolcache\windows\stack\2.15.3\x64;C:\cabal\bin;C:\\ghcup\bin;C:\mingw64\bin;C:\Program Files\dotnet;C:\Program Files\MySQL\MySQL Server 8.0\bin;C:\Program Files\R\R-4.3.2\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\SeleniumWebDrivers\EdgeDriver\;C:\SeleniumWebDrivers\ChromeDriver;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hostedtoolcache\windows\go\1.21.8\x64\bin;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\hostedtoolcache\windows\Ruby\3.0.6\x64\bin;C:\Program Files\OpenSSL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.402-6\x64\bin;C:\Program Files\ImageMagick-7.1.1-Q16-HDRI;C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\ProgramData\Chocolatey\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Microsoft SQL Server\160\DTS\Binn\;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\CMake\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.8.7\bin;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI\;c:\tools\php;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Amazon\SessionManagerPlugin\bin\;C:\Program Files\Amazon\AWSSAMCLI\bin\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\LLVM\bin;;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps;C:\Program Files\go-msi\

Running $env:PATH = "$env:PATH;C:\Program Files (x86)\WiX Toolset v3.14\bin" fixes the issue:

> candle.exe -?

LicenseAgreementDlg_HK.wxs WixUI_HK.wxs product.wxs 
Windows Installer XML Toolset Compiler version 3.14.0.8606
Copyright (c) .NET Foundation and contributors. All rights reserved.
@sergei-pyshnoi
Copy link
Contributor

Hello @kevgo . Thanks for your report. We will take a look.

@lzandman
Copy link
Contributor

lzandman commented Mar 25, 2024

The WiX Toolset installer adds a WIX environment variable that points to the WiX install directory. On my current test runner it contains this value:
WIX=C:\Program Files (x86)\WiX Toolset v3.14\

So you can run WiX commands from a Command Prompt by prefixing it:

"%WIX%"\bin\candle.exe

Of course the Install-Wix.ps1 script could also be augmented. Maybe like this:

################################################################################
##  File:  Install-Wix.ps1
##  Desc:  Install WIX.
################################################################################

Install-ChocoPackage wixtoolset -ArgumentList "--force"

# Add WiX to the PATH
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "Machine")
# Choose one of these next two lines, depending on the WiX priority
$NewPath = "$($Env:WIX)\bin;$currentPath"
#$NewPath = "$currentPath;$($Env:WIX)\bin"

[Environment]::SetEnvironmentVariable("PATH", $NewPath, "Machine")

Invoke-PesterTests -TestFile "Wix"

@kevgo
Copy link
Author

kevgo commented Mar 25, 2024

Thanks for looking into this! 🙏 I do not call the WiX binaries directly, but am using a third-party application to generate the Windows installer for my app. This third-party app calls the various WiX binaries for me. It is not aware of the WIX env variable and requires (rightfully imo) that I add the wix bin directory to the PATH.

In addition to the WIX env variable, I suggest adding the WiX binaries to the PATH so that they can be called idiomatically.

Btw please don't forget that the binaries are in the bin subfolder:

$NewPath = "$($Env:WIX + "\bin");$currentPath"

@lzandman
Copy link
Contributor

Btw please don't forget that the binaries are in the bin subfolder:

Oops, I indeed forgot to add the bin folder to my Powershell code. I updated my post.

@mikhailkoliada mikhailkoliada added the awaiting-deployment Code complete; awaiting deployment and/or deployment in progress label Mar 29, 2024
@mikhailkoliada
Copy link
Member

Deployed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Scripting and command line awaiting-deployment Code complete; awaiting deployment and/or deployment in progress bug report OS: Windows
Projects
None yet
Development

No branches or pull requests

5 participants