Recently, one of my build scripts failed with an odd error, claiming that the application wasn’t recognized. Given that the script had been working fine the previous day, this error was rather confusing.
Investigating the problem, I soon discovered the cause.
NuGet used to always store downloaded packages into a project specific .\packages\ folder. This folder only ever contained a single version of any one package, and my build scripts had previously only ever found one match when resolving wildcards.
This has all changed.
To avoid downloading the same package over and over again, and perhaps to save disk space too, NuGet now uses a cache of packages stored under the user profile. This means that there may now legitimately be multiple versions of a single package, catering for different projects needing different versions.
My build script failed because resolve-path call returned multiple results instead of just one.
How do we select just one version to use?
My initial solution was something like this:
Unfortunately, this didn’t return the version I expected - the result was version 2.5.9, not 2.5.11.
Comments
blog comments powered by Disqus