How to Keep Custom Install Locations When Upgrading Packages with Winget?

0
128
Asked By CuriousCucumber42 On

Hey everyone,

I've run into a bit of a problem while trying to upgrade my installed packages using Winget. Typically, I just use the command `winget upgrade --all` to update everything. But I have `BrechtSanders.WinLibs.POSIX.UCRT` installed in a specific custom location using this command: `winget install --location "WinLibs" -e BrechtSanders.WinLibs.POSIX.UCRT`.

After performing the upgrade, I noticed that my `gcc` alias stopped working. It turns out that when the package was updated, it was moved to the default installation location instead of staying where I originally placed it.

Is there a way to keep the package in its custom location during an upgrade for all packages? I couldn't find any useful information online, hence reaching out here.

P.S. This is the only package I've installed to a custom location, so I'm not sure if the issue is specific to this package or a general Winget problem.

3 Answers

Answered By CodingNerd42 On

You're spot on—Winget right now just re-runs the default installer during upgrades, which means no custom paths are retained. It's kind of a hassle.

The best workaround like you said is either to manage these manually or write a custom script to handle them differently, since re-running the installer usually just ignores those custom paths. I've seen this problem come up before, so definitely worth reporting it to GitHub if you haven’t already!

Answered By User12345 On

It’s important to note that the behavior you're experiencing isn’t just specific to Winget. When dealing with community-created packages like BrechtSanders, the install behavior can vary.

Winget essentially executes the default installer with some standard silent commands, so any custom path settings won't carry over unless the package itself is set to support that.

As for handling installs—how do you usually adjust the installation path during the initial install? If you're not using Winget for the initial custom path setup, that could lead to these issues.

Answered By TechieTom123 On

It sounds like you're facing a common issue with Winget—it doesn’t really keep custom install paths during an upgrade. Instead, it just reinstalls packages to default locations, which is likely why your `gcc` alias isn't working anymore.

A good way to handle this is what you mentioned: keep those custom installs separate. You might want to either create a script that lists these custom installations for exceptions or just reinstall them using `winget install --location ...` rather than upgrading. If you haven't already, consider posting about this on the Winget GitHub repo—it seems to be a fairly regular concern with dev toolchains!

DevGamer99 -

I totally agree with TechieTom! I faced the same issue before. Using a script to manage custom installs separately really helps out.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.