Checked out files related to loaded solution - visual-studio

I am using VS2015 and I work with 4 different projects and sometimes 2 different branches for a project. In VS a Team Explorer, under Pending Changes I see all the files checked out, from all the projects ( they are all host on the same tfs server). Each time when I want the make a commit I need to check to have only the files from the current opened solution and not check in anything else.
I was wondering is there is a tool/extension/option to only view as pending changes the files that are included in the current solution (the one that is opened in VS). This way I do not have to worry that I when I do a commit I include files from a different project.

Map different workspaces and switch between them as appropriate.

Just right click the solution/project/file in the VS solution explorer > Check In> then Just the files included in this solution/project/selected file in the Included Changes section, other files will be listed in Excluded Changes. So you can click Check In button directly.

Related

Visual Studio 2017 - moved local TFS workspace folders - best/correct process to re-connect?

Had to move my directories for the local workspaces for Visual Studio. I updated the directory locations in VS, but it acted as if they were completely out of sync, and asked to get latest.
I let it do so for one project - it (re)downloaded everything, came up with a list of files to which I had local changes, listing them as conflicts. I kept the local version of all the files, so no work was lost. But when I opened the project, those files came up as not being in source control, and it offered to let me add them. So again, I have all my work, but that's a tedious process to re-connect everything. Not to mention that I'm not sure I caught ALL the files that needed re-adding.
I've also considered copying everything to other directories, download a clean copy of the project(s), doing a compare and folding in my changes. Still messy, but possibly safer.
Is there a far better way to do this practice that I've missed? Perhaps as a side question, is there an easy way to list all the files in a project not in source control?
Guess you moved/changed local TFS workspace folders in file system directly. This caused some folders/sub-folders/files lost mapping.
In other words, all of these folders already out of source control. That's why you need to re-add or re-connect them to TFS source control.
A right way please refer how to move an item in TFVC:
You can use Source Control Explorer to move one file or folder at a
time. You should not use Source Control Explorer to move folders or
files that are referenced by a Visual Studio project or solution. Move
these files with Solution Explorer instead and check in the move in a
new changeset.
In Source Control Explorer, select the item that you want to move,
open its shortcut menu, and choose Move.
In the Move dialog box, either manually type the destination for the
item in the To box, or choose Browse to use the Browse for Folder
dialog box.
Choose OK.
Move is actually a delete and re-add process. You could also take a look at this similar question here: Moving project (under source control) to different folder
In your situation, a quick way to solve the conflicts should be: First back up your local files, delete your old workspace, create a totally new workspace. Get latest version from sever side to your new workspace.
Then copy your back-up files/folders which copied from old workspace folder to the new one. Windows system will judge to replace files and add new files.(It may take some time) After this, TFS system will auto detect the changes in local and will list them as new pending changes. Some new add files maybe stay in the Excluded list, manually promote them in Included list.
Finally check in all your pending changes, everything should get back on track.

Why does TFS show pending changes for all my files when I haven't changed anything?

I am new to using TFS source control.
I have a large project which I have been porting from SVN. I am checked in and up to date with all projects. However, I opened up Visual Studio today and all project items are in the pending changes included window even though there are no changes.
I haven't touched or edited any of the files for my TFS files since last time.
To verify, I used Araxis Merge to do a folder comparison and can see that no actual changes have taken place.
Why are these unchanged files appearing in my check-in window?
Here is an example of a diff in visual studio from the previous version:
I can't see anything!
Hopefully this shows my local workspace
When you create or edit a workspace, you can specify whether its location is Local or Server. Local Workspaces are TFS's attempt at DVCS and actually gives you a much more SVN-Like experience.
Edit the workspace and choose advanced, you could see the Location of workspace type.
Maybe formatting, line endings, encoding. Do a diff using Beyond Compare or something to see what changed.
If nothing changed, check if you are using the same workspace. You may select another workspace than you used.
In Source Control Explorer, check if you choosed the workspace the workspace you were work in.
If all above not work, you could also try this workaround, select all the files in "Pending changes" window and activate the context menu. Then click "Undo..." > "Undo Changes" > "No to All".
The files without changes will be rolled back. More details please take a look at this question: how to undo pending changes of files that are unchanged?

Pending Changes dialog shows files outside solution that shouldn't be there

If I open VS without opening a project/solution, I get a list of files in Pending Changes. The folders marked in red are solutions in my workspace, and those marked in green are branches of the solution.
However, when I open the respective solutions directly, none of those files are there. Somehow there is some overlap of what VS/TFS thinks needs to be checked in, even though in this case it is wrong.
I opened each solution from Pending Changes in turn, and there are no files to be checked in. I don't understand what (or why) it's showing me this list, and am concerned that if I accidentally check-in while showing "All" pending changes instead of solution-specific ones, that I will lose work.
Can anyone please explain why its showing these "phantom" pending check-ins? Even more bizarelly, the same of the solution in the title bar of pending changes is not even remotely related to some of the files shown.
If I delete my workspace, then create a fresh one, and then get recent, the problem goes away for a few weeks, but then randomly files start to appear back here.
This could be a source control binding error or some TFS cache issue.
Try to unbind/ bind this files in source control. File > Source Control > Advanced > Change Source Control
File > Source Control > Add to Source Control
Detail ways please refer: Project not showing as checked-in to TFS in Visual Studio 2013
Also give a try with clear VS and TFS cache

How can I see the change log of a directory with TFS?

I'm interested in seeing the latest changes that landed to a solution with TFS (I'm using Visual Studio). However, I can't seem to find the option: using View History on a solution or project brings up the history of the file itself. Am I missing something?
If you right click on folder the containing a solution in the Source Control Explorer window you'll see all changesets. It's obvious but I had to ask for it too. I am using TFS2010/VS2010.
Edit
Here are the steps:
Team/Connect to Team Foundation Server / select Team Project/ in Team Explorer dblclick on Source Control and in Source Control Explore right click folder containing your solution select View History and here you are.
The View History command will list you all the changesets where the file/directory was changed (add/move/content changed, deleted, etc.).
So if you do a View History on a .sln or .csproj file you'll see only the changes that were made inside the file's content, not on the "Visual Studio Item" and its related item.
To sum up, the View History command is only a File System history, there's not a smarter logic out there.
EDIT
The only way to know what changed inside a solution or project is to do a View History on the common denominator (i.e. the directory that contains everything you want to view history). But it'll still be a File System kind of History.
There's not Logical History for Solution and Projects in Visual Studio. For instance you can't know what files where added to a given project your viewing the history from two given versions. Or what projects were added/removed in the solution.
All the pieces are there (because all the changes are stored in the .csproj or .sln), but the feature itself that parses the content and retrieve the logic you want to see doesn't exist. (by the way, it's a great feature and I agree it should be there).
Bottom line: TFS/Visual Studio gives you two history system:
Based on the source control/file system, by displaying changesets.
Based on the source control/file system, by displaying labels.
That's all...
Right click on folder in solution explorer, and choose View History. Then you can see all the Changesets listed that apply to that directory. Then right click a particular changeset and choose Changeset details... to see what changes occurred in that changeset.

TFS files not added to solution but can be seen in source control

My partner and I are working on a project using TFS. For some reason when he adds files to the project then checks them in, I don't get them when doing an get latest version. The same thing happens when I check in files, he doesn't see them. We can both go in to source control and see the files are there, and even get latest version, but they are never added to the solution explorer. Any ideas what is happening?
If he, or you, has checked in the files, but not checked in the project file, then TFS will not download them if you execute a "get latest" by right clicking on the project or solution in Solution Explorer.
You WILL however get the files downloaded correctly if you right click and "get latest" on the folder in the source control window, however, they won't get loaded into your solution, because you haven't told TFS that they belong there.
Can you verify that the .csproj (or .vbproj, etc. depending on language) has been updated to actually include the new file(s)? Is the project file also being committed along with the new files?

Resources