chocolatey / chocolatey/choco

Add ability to correctly re-install packages without using the `--force` argument

Open
#2,724 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0 - Triaging Enhancement
Dominant language
C#
Stars
11.5k
Forks
961
PR merge metrics
No merged PRs in 30d

Description

## Is Your Feature Request Related To A Problem? Please describe.

There are times where there is a need to reinstall packages, during these times many use the argument `--force` to make this happen.

Instead, there should be a separate argument or command to allow this happen, where the package will first be uninstall and secondly the package will installed again with the same version that was already installed.
Due to the nature of this command, it should not do the normal cleanup af the `cacheLocation` where many binaries are cached initially during installation, and to honor the files still located in this place.
There `nupkg` file itself should however still be downloaded.
As with the `upgrade` command, reinstalling packages should also honor the previous arguments that was used.

## Describe The Solution. Why is it needed?

As there is no normal re-install functionality in Chocolatey CLI, there are users that instead uses the argument `--force` to make this happen.
Using `--force` may have side effects that may be undesirable to users (it is not a re-install, but rather a replacement. It ignores the existing files in the cache directory, and subverts other smart checks in the codebase).

## Additional Context.

If implemented, there will be a need to scan the codebase for places where `--force` is mentioned to use for reinstalls.

## Related Issues

- Issue #2277
- Comment https://github.com/chocolatey/choco/issues/227#issuecomment-557963699
- Issue #2088

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 by tracing the package install and uninstall flows and searching the codebase for existing --force handling. Review related issues #2277 and #2088 and the linked discussion before defining the command's behavior. Done means reinstalling the same version while preserving the cache, downloading the nupkg, and honoring the original arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.