Visual Studio isn't tracking changes, or checking out files from source control as I edit them

Visual StudioVisual Studio-2010Version ControlTfs

Visual Studio Problem Overview


I am new to TFS. At my job I mapped the TFS projects to local directories, performed a get, and everything works as I expected. When I edit files on my local copy, source control automatically checks them out for editing and tracks the files with pending changes via the pending changes window. Then I just check them in throughout the day using that window.

However, at home this doesn't appear to be happening. I have access to source control and using source control explorer, have mapped the projects to local directories. This appeared to work fine. However, when I open the projects and open files, changes I make are not automatically checking out files. In fact, visual studio isn't even changing their read-only status until I try to save my changes; at that point it warns me that the file is read-only and asks if I would like it to try to overwrite the permissions and save. I do and it works fine. But again, no changes register in the pending changes window. I'm kind of lost. The only source control experience I really have is subversion and the visual studio AnkhSVN plugin.

I've even opened my solution by double-clicking the solution file that is in source control explorer. You would think it would be fully-aware that the solution I'm opening should be tracked by source control.

Edit

Since people seem to be questioning my use of the phrase "at home", let me clarify. There are no problems with the network. I am on a VPN. I can browse source control just fine. I have since reinstalled everything for various reasons. All went well. I'm just having an issue with Visual Studio not tracking changes to files and allowing them to be committed back to source control. So to sum it up:

How could Visual Studio stop tracking changes after being mapped correctly, and allowing me to get latest? I can update from source control, I just can't commit. Pending changes window is empty even after making changes.

Visual Studio Solutions


Solution 1 - Visual Studio

Right-click on your solution node and go down to "Go online". For various reasons visual studio can mark your solution as tracked by source control, but "offline". It is still tracking changes behind the scenes waiting for you to go online again. After doing this my pending changes window populated and all is normal. I figured it was a simple setting somewhere.

Solution 2 - Visual Studio

I found an interesting setting under File > Source Control > Advanced > Change Source Control.

If I bind the solution and project to my source control server (unbind first if it's already bound), then suddenly it works! Saving a file automatically checks out the file and tracks changes.


Edit: this seems like a bug in Visual Studio. If this workaround helps you, it would be awesome if you create a new issue at https://developercommunity.visualstudio.com with your Visual Studio version info, so that the dev team can fix this!

Solution 3 - Visual Studio

Go into source control bindings (File->Source Control->Change Source Control) - you may notice only the project is bound - not the solution. Select the solution, click Bind.

Solution 4 - Visual Studio

I've just found how to fix this when you are already online (there is no "Go online" option visible). Actually, there ARE pending changes listed but they are hidden below the huge "Comment" section. To view them increase hight of the "Pending Changes" tab and decrease hight of the "Comment" section: you'll see the list of pending changes that was hidden by poorly scaled VS :)

Solution 5 - Visual Studio

in my case i solved issue by applying steps below:

  1. Right click your solution file on the solution explorer.
  2. click add solution to source control
  3. if you already added your files to tfs click ignore for file replacements popups

Solution 6 - Visual Studio

I was getting the "Read Only" error like everybody else. I got the little red check next to the files I was editing, but when I went to save, it asked me to save the file b/c it was read-only. I moved the files from a different version control system and they were still read-only. But I don't think Git cares about keeping files read-only like my old source control did. So I just removed the read-only flags in Windows Explorer and was good to go.

Solution 7 - Visual Studio

For me the solution was to go to Team Explorer Pending Changes window, and from there initiate the check-in. Did not see the go online option, i am on VS2013. Thanks to all for the pointers!

Solution 8 - Visual Studio

I found one of my projects actually wasn't added to the source control at all - somehow that had been missed and so any changes to that project would not get checked out. I right-clicked on the solution node, clicked "add to source control" it warned me that some projects were already being tracked and I elected to ignore those projects and it proceeded to add the missing project(s) to source control. Now the check-out works perfectly. Sharing in case it helps anyone else!

Solution 9 - Visual Studio

None of the answers/suggestions on this post helped me, but I've found a solution to the problem after hours of hair pulling.

  1. Locate your .git folder for your repository.
  2. Delete the index.lock file inside.
  3. Restart Visual Studio.

(I am using Visual Studio 2017.)

Solution 10 - Visual Studio

Close the solution . open the solution file in notepad Then remove the below section.

GlobalSection(TeamFoundationVersionControl) = preSolution
        SccNumberOfProjects = 2
        SccEnterpriseProvider = {3CF58AB4-18FA-4F8D-95D4-32DDF27D189R}
        SccTeamFoundationServer = https://serverIP/Project
        SccLocalPath0 = .
        SccProjectUniqueName1 = Ecample\\Example.csproj
        SccProjectName1 = Example
        SccLocalPath1 = Example
EndGlobalSection

then open the solution once again it should prompt to bind, do the binding properly.

Solution 11 - Visual Studio

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionChevView Question on Stackoverflow
Solution 1 - Visual StudioChevView Answer on Stackoverflow
Solution 2 - Visual StudioCarl WalshView Answer on Stackoverflow
Solution 3 - Visual StudioAbhishek KargawalView Answer on Stackoverflow
Solution 4 - Visual StudioValyaSView Answer on Stackoverflow
Solution 5 - Visual Studiocahit beyazView Answer on Stackoverflow
Solution 6 - Visual StudioTrevorView Answer on Stackoverflow
Solution 7 - Visual StudiobgolevView Answer on Stackoverflow
Solution 8 - Visual StudionamfordView Answer on Stackoverflow
Solution 9 - Visual Studiosusieloo_View Answer on Stackoverflow
Solution 10 - Visual StudioskoleyView Answer on Stackoverflow
Solution 11 - Visual StudioIlya GurenkoView Answer on Stackoverflow