microsoft / microsoft/winget-cli

`-l,--location` option not working on all msi packages

Open
#1,857 7 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Command-Install Issue-Bug
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

This issue is a followup on my PR for a package mainfest.

There seem to be a lot of inconsistencyes on how to set the install location path for msi packages. The code currently sets the TARGETDIR option.

https://github.com/microsoft/winget-cli/blob/b79e4087821c993f83f7c4731bbde7aa25612c73/src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp#L461

This is only one of two available options (see here) and some packages seem to require the alternative INSTALLDIR option.

I have tested the packages Oracle.JDK.17, StrawberryPerl.StrawberryPerl and ChristianHohnstadt.xca, which all currently don't work with the -l switch.

In contrast to that, the Borvid.HttpMasterExpress package works absoloutly fine as is.

One possible soloution would be to allways pass both of these options, which worked in my short testing.

Steps to reproduce

Use one of the following commands:

winget install Oracle.JDK.17 -l C:\ProgStuff\jdk
winget install Oracle.JDK.17 -l "C:\ProgStuff\jdk"
winget install Oracle.JDK.17 --override "/passive TARGETDIR=C:\ProgStuff\jdk"

The jdk is now installed into C:\Program Files\Java\jdk17 and NOT into the given location.

Only winget install Oracle.JDK.17 --override "/passive INSTALLDIR=C:\ProgStuff\jdk" works as expected.

Expected behavior

The package should be installed into the given Path.

Actual behavior

The given directory is ignored and the package is installed into the default directory.

Environment
[winget --info]
Windows Package Manager v1.1.13405
Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.

Windows: Windows.Desktop v10.0.19043.1415
Paket: Microsoft.DesktopAppInstaller v1.16.13405.0

Protokolle: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp around the linked TARGETDIR handling. Reproduce the issue with the Oracle.JDK.17 commands and compare the TARGETDIR and INSTALLDIR overrides described in the report. Done means the -l option installs affected MSI packages into the requested path without breaking packages that already work.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.