Last active
September 8, 2017 17:08
-
-
Save ComFreek/87bc3af278c991f729c5135446278ac5 to your computer and use it in GitHub Desktop.
Chocolatey: Fixing "Already referencing a newer version of 'packagename'"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<empty> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Improved script of https://github.com/chocolatey/choco/wiki/Troubleshooting#already-referencing-a-newer-version-of-packagename | |
# This script automatically filters the suspected candidates which are to be removed. | |
Get-ChildItem -Path "$env:ChocolateyInstall\lib" -Recurse -Filter "*.nupkg" | Where-Object { | |
# Filter packages with version number | |
$_.Name -match "^.*\.(\d+|\.){2,}\.nupkg" | |
} | Where-Object { | |
# whose parent directory does not contain the same version number | |
$_.Directory.BaseName -ne $_.BaseName | |
} | % { | |
# Remove -WhatIf after having run this script and having double-checked (!) each file listed in the previous | |
# run if it is really supposed to be removed (check the wiki link for information). | |
Remove-Item $_.FullName -WhatIf | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment