TFS - Latest field still showing "Yes" after deleting local files - visual-studio

In TFS Source Control Explorer my items are marked "Yes" in Latest field even though I have deleted all my local files. Is there a way to reevaluate that column so it shows "Not Downloaded" again?

Here is the solution if you want to delete your files from your local file system (using Windows Explorer for example) and change the column “Latest” in the Source Control Explorer from “Yes” to “Not downloaded”.
Go to “Get Specific Version…” on the files and select Changeset 1.
Changeset 1 is a special changeset on your TFS instance. If you do a get for changeset 1 on any actual files then they will not exist at that point in time on the system so will be deleted locally and the server will know this.
Link with the info: Removing source control files from your local file system

You should change the scope of your workspace to reflect what you do want locally.
You can also use the Cloak option to prevent sub folders.
https://msdn.microsoft.com/en-us/library/ms181378.aspx#mappings
You should never delete files locally when using a server workspace. If you use a local workspace TFS will lend delete those files from source.

Source Control Explorer reflects actions you performed to TFS instead of local file system. Please treat them separately. Visual Studio tries to keep them in sync, but it doesn't prevent you from deleting files directly.
Use tf get <files> /Force to re-get files you just deleted.

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.

Checked out files related to loaded solution

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.

How to add to visual studio solution a file that exists in TFS?

I've deleted a file by accident. Then I created another file with the same name. When I tried to check in the change, it didn't work out and got an error. I undid the changes then deleted the file, there's no more error when I try to check in.
I'd like now to get the latest version of the file before I deleted it.
Thanks for helping.
In TFS, a deletion only takes effect when you check in the said deletion change, and thankfully, this operation is reversible.
Here are the most common recovery scenarios, assuming that the file already had revisions stored in TFS before the accidental deletion:
If the file is still visible in the Source Control Explorer and is marked for deletion (under the Pending Change column):
Then it means that you've deleted the file from your solution (and file system), but that you didn't checked in the changes yet.
Use the "Undo" command of its contextual menu to restore the file in your workspace to its latest version before deletion.
From there, you'll be able to add the restored file to your solution.
If the file is still visible in the Source Control Explorer and is not marked for deletion:
Then it means that you've deleted the file from your file system.
Use the "Get Specific Version" command of the file's contextual menu to restore it in your workspace. In the "Get" window, select "Latest Version" and enable both options.
From there, you'll be able to add the restored file to your solution.
If the file is not visible in the Source Control Explorer:
Then it means that you've checked in the deletion change.
Turn on the "View deleted files" option of the Source Control Explorer (usually the 2nd button of its toolbar) to see your deleted file.
Use the "Undelete" command of the file's contextual menu to restore it in your workspace.
From there, you'll be able to add the restored file to your solution and you'll eventually have to check in the undeleted file to make it available to others, since this file only exists in your workspace.

"The item already exists" when adding trying to add files to TFS

I am having problems adding files to TFS Online. Here are the steps I made to get up to this point:
Created a project in TFS "SomeProject_Classic"
Mapped it to a path in my computer C:\SomeProject\classic
Pushed all files from from WITHIN the \classic folder to this project
Deleted the project in TFS
Recreated a new project in TFS with the same name ("SomeProject_Classic")
Mapped it to a path on my computer C:\SomeProject
I try to add the classic folder (not only the files in it like step 3, but the entire folder itself)
On this last step, it gives me the error "The item $/SomeProject_Classic/classic/somefile.txt already exists".
Basically, I think it is having a problem thinking that I have already added these files because I created a project with the same name in TFS and never "checked those files out for deletion" before deleting the project.. I feel like I need to clear a cache or TFS memory or something. Any advice?
Clean the Cache folder on client computer. The folder path is: C:\Users\username\AppData\Local\Microsoft\Team Foundation\6.0\Cache.
Use the tf destroy command to destroy, or permanently delete, version-controlled files from Team Foundation version control. Check:https://msdn.microsoft.com/en-us/library/bb386005(v=vs.100).aspx
This was somewhat related to Cece's answer in that even though it was deleted on the server, my local computer still thought the file were in the uploaded workspace.
What I did was create a temp folder TempRepo on my desktop and moved the files from the "classic" folder to it. I mapped my workspace to this TempRepo folder. Then I was able to "add existing files" to the workspace and push my files from this temp folder to Visual Studio Online.
When I was done, I just mapped the workspace back to the original folder and performed a "Get" operation. Now I have all the files uploaded onto TFS and the correct workspace set.
I just changed the file name. Fixed it.
Just do "Undo Pending changes" and delete the files and check-in again...problem will be fixed..

Borland Starteam incorrect files status

I have some project saved in starteam. As there are a lot of obsolete files I can't check in or check out all project, only changed files. Now I copy project from one computer to another for other developer. I expect starteam treats copied project as new item for check in and check out, but it don't.
Forexample:
I modified file on first computer.
I update list of files on second computer and see this file in "check in" list, as I modified it on second computer.
It is incorrect.
I think there is some configuration file or something like, that saves computer (or user) settings. So when project is copied, settings is copied too.
Do anybody know how to change this configuration to set copied project as new instance of starteam???
You should be able to Right-Click on either the file or a close group of files (such as the Modified group) on the file tab within a project and choose the Update Status option. This will cause StarTeam to analyze the file to try to determine if they truly are the same as what is in source control. Then you can refresh the list and it should change most of your files to current.
There is also a configuration setting under Tools->Personal Options->File tab that is "Use file checksums (MD5) to calculate status". This may be useful to you as a different way to have StarTeam determine if the file on your local disk is the same as what is in source control.
It sounds like you are using a custom filter/query for your check-in list. The status for the files that are copied/moved would be "unknown" and they can still be checked-in by checking the "force check-in" checkbox in the check-in dialog. Just verify that the local version is correct by using compare contents before committing it.
You can try switching from a central file status repository to a "per folder" repository. This will create .sbas folders wherever you check-out files and should maintain status for local files when their containing folder is copied or moved. Look under Tools, Personal Options on the File tab under Repository.

Resources