11

I'm using Visual studio 2013 with TFS 2013. I've been trying to get all files in a folder to not checkin using .tfignore and with hours of searching and trying different solutions with no luck. I followed the instructions http://msdn.microsoft.com/en-us/library/vstudio/ms245454.aspx and could not get it to work. Any help is appreciated.

My project structure looks something along the lines of:

  • project
    • Controls
    • TestIgnore
      • Class1.cs
      • Class2.cs
    • .tfignore

and my .tfignore has 1 line of code: \TestIgnore

My workspace is set to local.

When I make changes to Class1.cs, when I check in, Class1.cs is in the pending check in list which I believe it should not.

vkom
  • 233
  • 4
  • 12
  • 2
    Was the Class1.cs file previously committed? You can only ignore files that have _never_ been checked in. – Michael Sorens Aug 09 '14 at 20:35
  • Yes, Class1.cs is already in TFS. I'll give it a try with a file not in TFS and see how that goes – vkom Aug 11 '14 at 15:06
  • I tried adding a new file in the TestIgnore folder but it was still trying to check the file in. This may be due to the .csproj file adding a record for the new file that it tries to check it in? – vkom Aug 11 '14 at 16:51
  • Did you add the file through the Solution Explorer? If so, those files are automatically added to your pending changes. Only when you directly add files through Windows Explorer or something files are not added by default. – Wouter de Kort Aug 12 '14 at 06:10
  • 1
    I asked the same question on msdn and got a reply saying it seems to be a bug in VS 2013 for not supporting tfignore. I submitted a bug on msdn as well and well close this question. Hopefully it will get fixed soon. – vkom Aug 18 '14 at 15:12
  • 1
    When reading this comments, it becomes obvious that .tfignore is completely unusable. :-( – realtime Sep 17 '14 at 06:01
  • @vkom **Or** you could post your last comment as an answer and (a few hours later) accept it. "It's not possible " or "It's a bug " are valid answers, too. – TobiMcNamobi Sep 24 '14 at 07:14

4 Answers4

7

I was very frustrated with this, and nothing seemed to work despite having the .tfignore file in the same folder as the solution, and deleting the packages folder (which I'm trying to get TFS to ignore) After building, nuget would restore the packages and the packages would show up in the pending changes window.

But on a whim, and remembering some vague comment I saw somewhere, I right-clicked on the solution in the solution explorer, and chose "Enable Nuget package restore" - which adds a .nuget folder to the solution, and lo and behold, suddenly the packages folder WAS ignored when checking in the solution to TFS.

I exited VS2013, deleted the packages folder, opened the solution again, selected "Rebuild solution" and the packages were restored, but nothing shows in the pending changes window. Success at last!

Upon further investigation, it appears it's the nuget.config file and the setting "disableSourceControlIntegration=true" which is necessary as seen in http://nuget.codeplex.com/workitem/4072

Kristian
  • 336
  • 3
  • 7
  • 1
    Thanks, this was exactly my problem in VS2013 using TFS and NuGet package restore. The .nuget/NuGet.Config file is the critical piece. See http://docs.nuget.org/docs/workflows/migrating-to-automatic-package-restore which states "By default, the NuGet.Config file instructs NuGet to bypass adding package binaries to source control. Automatic Package Restore will honor this as long as you leave this file in place. Note that NuGet.Config only has an effect when using Visual Studio to integrate with Team Foundation Server (TFS)." – BrandonLWhite Jan 26 '15 at 19:57
  • 1
    So with the new "Automatic Package Restore" magic (which is more or less zero-config) it looks like you must manually add this .nuget/NuGet.Config file to prevent NuGet from adding all the restore packages to your Pending Changes. Just having it in .tfignore is not enough since you must also prevent NuGet from adding them programmatically via the TFS API. – BrandonLWhite Jan 26 '15 at 20:05
  • 3
    Thanks guys! I have a .tfignore set to ignore the packages folder and my nuget.config has disableSourceControlIntegration set to true, but visual studio still wants to try to add packages. Any ideas on what could still be going wrong? – Dan Csharpster Feb 09 '15 at 16:16
  • @kristian, could you make your comment an answer? What you said solved the problem for me, and I would like to give you credit. – Richard II Aug 11 '15 at 19:46
  • @RichardII, I added my comment in the original answer – Kristian Aug 14 '15 at 06:38
  • @kristian, the part of your answer that helped me was setting "disableSourceControlIntegration=true" in nuget.config. I was warned never to choose "Enable Nuget package restore" in VS2013--that it had some really bad side effects. Did you run into any? – Richard II Aug 17 '15 at 14:13
  • @RichardII, no, that never had any obvious side effects for me really – Kristian Aug 18 '15 at 06:38
6

I asked the same question on msdn and got a reply saying it seems to be a bug in VS 2013 for not supporting tfignore. I submitted a bug on msdn as well and well close this question. Hopefully it will get fixed soon.

vkom
  • 233
  • 4
  • 12
1

tfIgnore does not work for me in Visual Studio 2013

Edward Wilde's answer fixed it for me. I had to delete the already checked in packages on the source control itself. Then tfs would ignore the changes.

Community
  • 1
  • 1
mac10688
  • 2,145
  • 2
  • 24
  • 37
0

I had a similar issue where TFS was preventing me to checking a .tfignore file placed 2 folders down from the Project root.

I got it to work ONLY when the .tfignore file was placed on the project's root folder. (.tfignore file placed side by side to "Main" folder).

In this way, TFS let me checkin my .tfignore file.

ThiagoPXP
  • 5,362
  • 3
  • 31
  • 44