LocalPackageRepository throws when packages are being written

Topics: General
Feb 19, 2013 at 3:31 AM
I've had this bug report a few times:
  1. Users are using a local package repository (\server\path)
  2. Their build server is writing a package to it over the WAN
  3. No one can list any packages from the repository because a file is locked
The errors occur because when trying to open a package for reading, NuGet doesn't allow sharing with a write lock on the file. Even if this is changed, OpenPackage fails if the package hasn't been fully written yet (e.g., the manifest might not have been written). These errors mean the entire feed is unavailable rather than just the locked package.

My workaround is here. I'm simply ignoring packages that can't be read, making it more robust.