PowerShell / PowerShell/PSResourceGet
Unstall-PSResource does not uninstall dependencies
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 576
- Forks
- 114
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 7
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
When uninstalling a module (ModuleA) which has a dependency on another module (ModuleB) and no other module depends on ModuleB, ModuleB is not uninstalled when uninstalling ModuleA.
Repro:
# I first make sure I don't have any Az* modules installed
Get-Module Az* -ListAvailable
# Installing Az.Storage will also install Az.Accounts
Install-PSResource Az.Storage -TrustRepository
# Confirm I now have Az.Storage and Az.Accounts installed
Get-Module Az* -ListAvailable
# Now uninstall Az.Storage
Uninstall-PSResource -Name Az.Storage
# Az.Accounts is still installed altho nothing is depending on it and I have not explicitly installed it
Get-Module Az* -ListAvailable
Expected behavior
If I install a module that comes with a set of dependencies, I would expect those dependencies to be uninstalled with the module or at least that I'm informed about them being left behind.
I realise there might be scenarios where removing dependencies might be unwanted, like if I explicitly have installed the dependency. Maybe that could be solved with an opt-in solution like a -IncludeDependency parameter.
Actual behavior
Only the module I uninstall is removed, not any of the dependencies.
Error details
No response
Environment data
Get-Module Microsoft.PowerShell.PSResourceGet
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 0.5.23 beta23 Microsoft.PowerShell.PSResourceGet {Find-PSResource, Get-InstalledPSResource, Get-PS…
$PSVersionTable
Name Value
---- -----
PSVersion 7.3.4
PSEdition Core
GitCommitId 7.3.4
OS Darwin 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:23 PDT 2023; root:xnu-8796…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Uninstall-PSResource entry point and reproduce the Az.Storage/Az.Accounts scenario from the issue. Trace how installed dependencies are identified and removed, then add coverage for the chosen dependency-removal behavior, including the case where a dependency is not used by another installed module.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100