Deleted branch still appears in other instance of Visual Studio - visual-studio-2013

So we're using TFS2013 and I created a test folder, then added a test file to it, then converted the folder to a branch and then deleted the branch. (I did this to see what would happen if you try to delete a branch that has files checked out). But when I open TFS on another machine I still see that branch. Locally it's disappeared from view, but on the remote server (our build server) it still shows up as being there. I checked out the test file on the remote machine and then deleted the branch on my local machine, so I thought it was still appearing because I had pending changes, but I undid them, refreshed source control explorer and even closed and reopened VS and it still appears there. I checked with another developer and he doesn't see it, but I still don't understand why it's appearing on the build server.
Anyone have any ideas?

You need to check in the Pending Changes after deleting the branch, otherwise the branch will not be deleted from remote server.
For other client machines which ever connected to the project, you need to Get Latest Version from the remote server to delete the existing local branch. (Sync with remote server to delete the branch)

Right-click on the branch in Visua Studio then select "View History".
On the top of the list you should see the changeset related to the deletion, Right-click on it then select "Get This Version".

Related

How to force TFS server to take all of my local files?

I have a couple of ASP.NET Core based projects being developed using Visual Studio 2019.
I am having issues where my workspace and TFS server on Azure-DevOps are out of sync. My PC contains the most recent code and I want to push everything I have on the server. I don't really care about the status of the TFS server as it is wrong. I just want to force everything to get pushed to ensure my PC and TFS are syncing again.
How can I force the TFS on Azure-DevOps to take all my files? I don't even mind removing the project altogether from Azure-DevOps and push all files as if this is a new project.
According to your description, sounds like there is something wrong with your source control binding. Or maybe some files outside of Visual Studio do not detect by TFS server. Which cause your workspace and TFS server out of sync.
If you want TFS server detect changes done to files outside of Visual Studio, the simplest way is using local workspace.
Now anything else changes files outside Visual Studio, your workspace detects the changes automatically.
It also detects adds or deletes but you have to include them to your Pending Changes manually with the link under `Excluded Changes
If you are using server workspace, this is kind like when you are offline, you cannot work with your local files because they are read-only until you check them out. So highly recommend you switch to local workspace, you just need to make sure you open the files in VS from a path which the same as your TFS local worksapce. Then it will auto sync changes in Visual Studio and show in pending changes.
More detailed information on the pros and cons of local and server workspaces, please refer our official link.
Now in your situation, we suggest you fist back up all of your local codes/files first. Then delete your old workspace, create a new local workspace.
Get latest from your sever, then copy all your back up to your workspace folder. Then let windows file system auto detect the difference between them, replace files download from server with your back up local version.
Now your local workspace should contain the latest version of your code/file, Visual Studio will auto detect the changes and list them in pending changes, if something added in excluded list, manually promote them.
Finally you could just check in/push all pending changes to TFS server. Now everything back to the track again.
Hope this helps.

A project vanished from my local TFS workspace. It's added to source control but not checked in. Anywhere else to find it?

This is a bit strange.
I created a project, added it to source control, worked on it for a day or two, but never checked it in.
Somehow, the project went missing from my local workspaces folder. It's just gone.
In Source Control Explorer in VS.. it shows a green plus next to the project on both the TFS pane and the local pane.
If I right click the project in the local pane and choose Check In, it prepares my check-in, and when I finally proceed with the check-in process, I get this error:
C:\Users\<me>\Source\Workspaces\Workspace\AG\libCrypto\AGCrypto.sln: Could not find a part of the path 'C:\Users\<me>\Source\Workspaces\Workspace\AG\libCrypto\AGCrypto.sln'.
Because, as I said.. the project folder vanished. This is really concerning.. especially if it were to happen to a larger project. Under no circumstance would I ever manually remove something from my workspace folder.
Could there possibly be anywhere else where I might be able to find my project? Maybe in some cache/temp location?
I'm using VS 2015 Enterprise, TFS2015
TFS won't remove project from workspace. I'm afraid you there is wrong process or operation on your local machine causes the project deleted.
As your project hasn't been checked into TFS, TFS doesn't have record for this project, it's unable to get your project back on TFS side.
You need to focus on how to recover files on your local machine if you need the project back.

How to convert a deleted regular directory into a branch in TFS?

I'm in the middle of migrating a repository from TFS to Git, and I'm using git-tfs.
I've already converted my Trunk branch using 'git tfs clone ...' successfully. When trying to 'git tfs branch --init' a related branch it fails with the error message: 'error: TFS branches $/foo/myrelatedbranch not found!'
This seem to be caused by the $/foo/myrelatedbranch no being a proper tfs branch. The 'branch' documentation (https://github.com/git-tfs/git-tfs/blob/master/doc/commands/branch.md) seem to be pretty clear on the related branch having to be a PROPER branch (https://github.com/git-tfs/git-tfs/blob/master/doc/commands/branch.md#merge-changesets-and-branches).
The branch $/foo/myrelatedbranch has been deleted a while back, so I'm not able to see the option 'Branching and Merging -> Convert to Branch' in the Source Control Explorer.
Is there any way of making this deleted directory a proper branch in TFS?
Using Visual Studio 2015 and TFS 2015
You can configure the Source Control Explorer to show deleted items:
From the menu bar choose Tools, Options.
On the Options dialog box, navigate to Source Control, Visual Studio Team Foundation Server.
Select Show deleted items in the Source Control Explorer, and then choose OK.
If you now open the Source Control Explorer, you can view the deleted folder and convert the folder to a branch.
You can also rollback the changeset that deleted the folder. The rollback will create a new changeset where the changes are negated (so in this case, where the folder is added).
If the problem still exists, you could just take a snapshot of the latest version and migrate that to Git.

I deleted my working copy but TFS thinks I've still got it

I deleted a local copy of a TFS source-code branch (actually I renamed the branch and had to delete the old-named version), but Source Control Explorer window in Visual Studio says I still have the latest version so whenever I double-click a file, I get an error that the file doesn't exist.
Is TFS supposed to notice when I delete a local working copy i.e. this is a glitch?
How can I address it? Get the latest version and then delete it?
Is TFS supposed to notice when I delete a local working copy...?
No. TFS TFVC expects that it controls your working directories, at least with a Server Workspace. When you start doing things without telling it, then it has no idea.
If you want to remove files from your local drive, do a get of changeset 0 on that path (where the files won't be) and/or delete your working folder mapping or delete the TFS workspace.
Why does it work this way? Performance. If you have 10+ GB of sources, you can't afford to have your version control system scanning your filesystem to try to figure out what you've done. That's why TFVC Server Workspaces work this way.
Change your workspace to a Local Workspace if you have only a small bit of source code and you want to scan the filesystem for changes. Or switch to Git in TFS if you want a complete distributed experience.

Visual Studio 2010 Team Foundation Server Source Control Issue

Source control is acting wierd.
Here is the scenario:
I had to reformat my computer. I backed everything up first, then blew it away. All of my backup is located on a virtual harddrive on the network, which I can connect to in order to grab what I need temporarily.
I have re-added my website / project to the same file location but now source control doesn't seem to be working.
I have made some edits which I believe the second developer does not have.
Also, the second developer has made some new edits to the website and because I am not properly hooked in to source control I cannot get those changes.
Does anyone have any ideas on what the problem could be?
Your local machine keeps a cache of the server and local workspace configuration - you will need to rebuild this cache. In addition, your Team Foundation Server workspace is tied to your original computer (workspaces are uniquely identified by your local hostname, the workstation name, and your username.) If your hostname has changed on your new computer, the server will not be able to find your existing workspace and thus it will not be able to participate in source control.
If your hostname is the same and you have copied all of your source tree over to the identical location, you should be able to simply rebuild your workspace cache on your new machine. As soon as you connect to the server (using Team Explorer in Visual Studio, or with the tf command line client) your workspace cache will get rebuild and you should have a copy of the pending changes you had on your old computer.
If, however, your workstation's hostname has changed, you can update the the hostname associated with your old workspaces. You can do this by running the command:
tf workspaces /updateComputerName:oldComputerName /collection:http://tfsserver:8080/tfs/MyCollection
Finally, you have one other option: you can simply create a new workspace and copy your changes in. You would do this by creating a new TFS workspace, getting the latest version of the code to a different directory, copying your changes over, and then detecting those changes and pending them to the server by using tfpt online from the Team Foundation Server Power Tools.

Resources