1
votes

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

2

2 Answers

1
votes

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

1
votes

Option 1: You need to adds .tfignore to the packages folder with "*/" as a filter. You effectively don't ever want to check anything in under this folder other than the config file.

http://msdn.microsoft.com/en-us/library/ms245454.aspx

Option 2: (Better) Add a nuget.config file to your solution, convention is to place it under a folder named .nuget - but it can stay at root too. Content should be:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
   <solution> 
      <add key="disableSourceControlIntegration" value="true" /> 
   </solution> 
</configuration> 

That will exclude the packages folder, you don't need anything in there. NOTE: If you're using NuGet 2.7 or above, automatic restore is on by default. Don't use the "Enable NuGet Restore" in your solution, it adds the old way of doing this. See http://geekswithblogs.net/terje/archive/2014/06/11/converting-projects-to-use-automatic-nuget-restore.aspx