Search code examples
visual-studiotfsnugetgated-checkin

Nuget files are locked every time Gated Checkin Build fails


I know that NuGet restoration could place checkout locks on the package folder and the contained files. But why does TFS Build not release those locks in the event of Gated Checkin Build failing due to compilation errors?

When Gated Checkin Build fails, Visual Studio does not allow to unshelve changes because files are locked by TFS service on the build server. Visual Studio does not allow unshelve changes because files are being locked by TFS Build

TFS Sidekick shows multiple files being locked by TFS service account. TFS Sidekick shows multiple files are being locked under TFS service account


Solution

  • If your solution is set to restore NuGet Packages you don't need to check packages into TFS as they will be restored on the build, Setting your solution to Restore packages will stop TFS from trying to add packages to the packages folder.

    As MrHinsh says, Your packages folder within TFS should contain nothing more than the Config file