12

I'm using Visual Studio 2015 update 3 with TFS hosted at visualstudio.com. When I add a C# class file to one of my projects in Visual Studio, it's not automatically added to source control. For other projects in the same solution, C# class files are added automatically, as expected.

When I then add the file, manually, in the project with this problem, I get the following question;

enter image description here

I have to confirm to add the file to source control.

There is a similar question (Visual Studio 2015 new files not being added to source control automatically), associated with a "release" branch, which is not the case here (at least I think so - our TFS-project has never been branched)

We've never configured any .tfignore manually. This started to happen recently and occurs on all development machines, so it's probably not a client machine issue.

I'm clueless, so any help is highly appreciated.

UPDATE

I've discovered that the problem occurs in projects with names ending with ".Lib"

Projects:

  • Core (ok)
  • Core.Lib (files not added automatically)
  • Communication (Ok)
  • Communication.Lib (files not added automatically)

I tried to add a test project Test.Lib to my solution. This project was not added to TFS either, but project Test was.

Community
  • 1
  • 1
Frode
  • 3,325
  • 1
  • 22
  • 32
  • 1
    Is the file referenced correctly in the .csproj file? It could be that TFS thinks it's not part of the project so doesn't need adding. – ChrisF Aug 13 '16 at 11:43
  • 1
    @ChrisF: I'm changing my question as I've found new information. This is actually a problem with some projects. Not all projects have this issue, after all. I'll update my question with new info. I think you are on to something. I'll give updates in a few – Frode Aug 13 '16 at 11:49
  • 1
    Question has been updated – Frode Aug 13 '16 at 11:57
  • 1
    Me too, using VS2015 Update 3 with a TFS 2010 server. – Zartag Dec 07 '17 at 16:31

1 Answers1

10

The "lib" extension is the problem. Try renaming the project folder to something else, eg. "CoreLib".

To reproduce this behavior / bug, try the following:

  1. Create a Test directory in a directory controlled by TFS
  2. Create a Test.Lib subdirectory in this directory.
  3. Add a file, test.cs, to Test.Lib. (Test\Test.Lib\test.cs)
  4. In Visual Studio's Source Control Explorer, try adding the new Test directory to source control. You'll see test.cs on the "Excluded items" tab.

The "lib" extension is used by binary files, and these are ignored by Team Explorer by default. I haven't found an official list of filetypes anywhere, but other affected file types are dll, exe, obj and possibly others. You can include these files manually by right-clicking them and selecting "Include".

EventHorizon
  • 2,916
  • 22
  • 30
  • 1
    I'll give it a try. Sounds right, but I've always followed this naming pattern with no problems. – Frode Aug 14 '16 at 20:33
  • 1
    Sound like the most plausible explanation. Behaviors in TFS must have changed recently. IMO it should still be possible to NOT filter out folders and projects ending with ".Lib" (!). But there might be some higher reasons I'm not aware of – Frode Aug 14 '16 at 21:11
  • 1
    @Frode it seems this started with VS2015 Update 3. Relevant: http://stackoverflow.com/questions/38523861/visual-studio-2015-new-files-not-being-added-to-source-control-automatically – Christian Rodriguez Oct 17 '16 at 10:39
  • 1
    @ChristianRodriguez Thanks for info. We haven't had any issues after renaming X.lib projects to X.contracts. Seems to me that both issues are related to the TFS behavior of excluding folders by naming convention. Probably introduced in Update 3. Lets hope they change it again – Frode Oct 18 '16 at 17:59