WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
When working on various projects, the required packages (IDEs, SDKs, etc.) change over time. Uninstalling packages manually takes time as you also need to think about which package is still used and which is not.
Using winget import we can import package lists per project to get our environment set up swiftly. But there is no complementary method to also uninstall all these packages again without destroying the environment for other projects that have package requirements in common.
It would be very helpful to have a means of "letting go" of packages.
For example; Project A needs package 1 and 2. Project B needs package 1 and 3. When Project A ends, package 2 should be trivial to remove as there is no longer a need for it. I would expect that if package 2 was installed manually without a specification for its needs, it to remain installed.
I do not care what the term would be for this mechanism. I can imagine it could be "needs, reasons, environment, or requirements".
Going further, sub-needs could be a nice addition. So that if you only need programming or content packages for ProjectA for instance you can only install what you need, or uninstall what you no longer need but keep the rest. Though, this can also be solved in other ways with just the basic feature.
winget need ProjectA list packages needed for ProjectA
winget need ProjectA --drop drop the need for ProjectA. Potentially uninstalling packages that were only needed by ProjectA.
When packages are listed, show where they are needed or whether they were installed without a need.
Description of the new feature / enhancement
When working on various projects, the required packages (IDEs, SDKs, etc.) change over time. Uninstalling packages manually takes time as you also need to think about which package is still used and which is not.
Using
winget import
we can import package lists per project to get our environment set up swiftly. But there is no complementary method to also uninstall all these packages again without destroying the environment for other projects that have package requirements in common.It would be very helpful to have a means of "letting go" of packages.
For example; Project A needs package 1 and 2. Project B needs package 1 and 3. When Project A ends, package 2 should be trivial to remove as there is no longer a need for it. I would expect that if package 2 was installed manually without a specification for its needs, it to remain installed.
I do not care what the term would be for this mechanism. I can imagine it could be "needs, reasons, environment, or requirements".
Going further, sub-needs could be a nice addition. So that if you only need programming or content packages for ProjectA for instance you can only install what you need, or uninstall what you no longer need but keep the rest. Though, this can also be solved in other ways with just the basic feature.
Proposed technical implementation details
Example commands
winget install -e --id Google.AndroidStudio --need ProjectA
winget install -e --id Google.AndroidStudio --need ProjectB
winget install -e --id Google.AndroidStudio --need ProjectA ProjectB
winget import -i ProjectA.json --need ProjectA
winget need ProjectA
list packages needed for ProjectAwinget need ProjectA --drop
drop the need for ProjectA. Potentially uninstalling packages that were only needed by ProjectA. When packages are listed, show where they are needed or whether they were installed without a need.